bloritsch 02/02/07 14:06:54
Modified: src/scratchpad/org/apache/avalon/excalibur/system
AbstractContainer.java
Log:
fix nullpointerexception
Revision Changes Path
1.16 +15 -15
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/AbstractContainer.java
Index: AbstractContainer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/AbstractContainer.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AbstractContainer.java 7 Feb 2002 21:58:19 -0000 1.15
+++ AbstractContainer.java 7 Feb 2002 22:06:54 -0000 1.16
@@ -36,7 +36,7 @@
* Manager can expose that to the instantiating class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.15 $ $Date: 2002/02/07 21:58:19 $
+ * @version CVS $Revision: 1.16 $ $Date: 2002/02/07 22:06:54 $
*/
public abstract class AbstractContainer
extends AbstractLogEnabled
@@ -440,7 +440,7 @@
*/
public ContainerComponentManager( Map componentMap, ComponentManager
parent )
{
- m_parent = null;
+ m_parent = parent;
m_components = componentMap;
m_used = new HashMap( m_components.size() );
}
@@ -450,19 +450,7 @@
{
Object temp = m_components.get( role );
- if ( temp instanceof ComponentSelector )
- {
- return (ComponentSelector) temp;
- }
-
- if ( ! ( temp instanceof ComponentHandler ) )
- {
- throw new ComponentException( "Invalid entry in component
manager: " + temp );
- }
-
- ComponentHandler handler = (ComponentHandler) temp;
-
- if ( null == handler )
+ if ( null == temp )
{
if ( null != m_parent )
{
@@ -473,6 +461,18 @@
throw new ComponentException( "The role does not exist
in the ComponentManager" );
}
}
+
+ if ( temp instanceof ComponentSelector )
+ {
+ return (ComponentSelector) temp;
+ }
+
+ if ( ! ( temp instanceof ComponentHandler ) )
+ {
+ throw new ComponentException( "Invalid entry in component
manager" );
+ }
+
+ ComponentHandler handler = (ComponentHandler) temp;
final Component component;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>