mcconnell 2002/12/16 20:55:47
Modified: assembly/src/java/org/apache/avalon/assembly/lifecycle
ContextHandler.java
Log:
Improved error handling in case is invalid custom context class.
Revision Changes Path
1.5 +10 -3
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/ContextHandler.java
Index: ContextHandler.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/ContextHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ContextHandler.java 14 Dec 2002 21:04:41 -0000 1.4
+++ ContextHandler.java 17 Dec 2002 04:55:47 -0000 1.5
@@ -110,7 +110,6 @@
public void contextualize( Context context ) throws ContextException
{
m_context = context;
- //m_classloader = (ClassLoader) context.get( "urn:assembly:classloader" );
}
//==============================================================
@@ -257,10 +256,18 @@
new Class[]{Map.class, Context.class} );
result = (Context)constructor.newInstance( new Object[]{map, null}
);
}
+ catch( NoSuchMethodException e )
+ {
+ final String error =
+ "Custom context class: [" + classname
+ + "] does not implement the required constructor pattern <init>(
Map, Context ).";
+
+ throw new ContextException( error, e );
+ }
catch( Throwable e )
{
throw new ContextException(
- "Unexpected exception while creating context form "
+ "Unexpected exception while creating context from "
+ classname, e );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>