You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by bl...@apache.org on 2002/01/30 17:49:05 UTC
cvs commit: jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/component ExcaliburComponentManager.java ExcaliburComponentSelector.java
bloritsch 02/01/30 08:49:05
Modified: src/java/org/apache/avalon/excalibur/component
ExcaliburComponentManager.java
ExcaliburComponentSelector.java
Log:
Add fixes from Leif for better error reporting
Revision Changes Path
1.16 +24 -4 jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java
Index: ExcaliburComponentManager.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ExcaliburComponentManager.java 8 Jan 2002 18:06:07 -0000 1.15
+++ ExcaliburComponentManager.java 30 Jan 2002 16:49:04 -0000 1.16
@@ -33,7 +33,7 @@
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
* @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
- * @version CVS $Revision: 1.15 $ $Date: 2002/01/08 18:06:07 $
+ * @version CVS $Revision: 1.16 $ $Date: 2002/01/30 16:49:04 $
* @since 4.0
*/
public class ExcaliburComponentManager
@@ -408,17 +408,37 @@
final Class clazz = m_loader.loadClass( className );
addComponent( role, clazz, configurations[ i ] );
}
- catch( final Exception e )
+ catch( final ClassNotFoundException cnfe )
{
final String message = "Could not get class ";
if (getLogger().isErrorEnabled())
{
getLogger().error( message + className + " for role " + role +
- " on configuration element " + configurations[ i ].getName(), e );
+ " on configuration element " + configurations[ i ].getName(), cnfe );
}
- throw new ConfigurationException( message, e );
+ throw new ConfigurationException( message, cnfe );
+ }
+ catch( final ComponentException ce )
+ {
+ final String message = "Bad component ";
+
+ if (getLogger().isErrorEnabled())
+ {
+ getLogger().error( message + className + " for role " + role +
+ " on configuration element " + configurations[ i ].getName(), ce );
+ }
+
+ throw new ConfigurationException( message, ce );
+ }
+ catch( final Exception e )
+ {
+ if (getLogger().isErrorEnabled())
+ {
+ getLogger().error("Unexpected exception for hint: " + role, e);
+ }
+ throw new ConfigurationException( "Unexpected exception", e );
}
}
}
1.10 +29 -10 jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java
Index: ExcaliburComponentSelector.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ExcaliburComponentSelector.java 11 Dec 2001 09:53:27 -0000 1.9
+++ ExcaliburComponentSelector.java 30 Jan 2002 16:49:05 -0000 1.10
@@ -35,18 +35,18 @@
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
* @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
- * @version CVS $Revision: 1.9 $ $Date: 2001/12/11 09:53:27 $
+ * @version CVS $Revision: 1.10 $ $Date: 2002/01/30 16:49:05 $
* @since 4.0
*/
public class ExcaliburComponentSelector
extends AbstractLoggable
- implements Contextualizable,
- ComponentSelector,
+ implements Contextualizable,
+ ComponentSelector,
Composable,
Configurable,
- Initializable,
- ThreadSafe,
- Disposable,
+ Initializable,
+ ThreadSafe,
+ Disposable,
RoleManageable,
LogKitManageable
{
@@ -353,16 +353,35 @@
final Class clazz = m_loader.loadClass( className );
addComponent( hint, clazz, instances[i]);
}
- catch( final Exception e )
+ catch( final ClassNotFoundException cnfe )
{
final String message =
- "The component instance for '" + hint + "' has an invalid class name.";
+ "The component instance for '" + hint +
+ "' has an invalid class name (" + className + ").";
+ if (getLogger().isErrorEnabled())
+ {
+ getLogger().error( message, cnfe );
+ }
+
+ throw new ConfigurationException( message, cnfe );
+ }
+ catch( final ComponentException ce )
+ {
if (getLogger().isErrorEnabled())
{
- getLogger().error( message, e );
+ getLogger().error( "The component instance for '" + hint +
+ "' is not valid.", ce );
}
- throw new ConfigurationException( message, e );
+ throw new ConfigurationException( "Could not set up component", ce );
+ }
+ catch( final Exception e )
+ {
+ if (getLogger().isErrorEnabled())
+ {
+ getLogger().error("Unexpected exception for hint: " + hint, e);
+ }
+ throw new ConfigurationException( "Unexpected exception", e );
}
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>