mcconnell 2003/09/06 06:36:36
Modified: merlin/activation/src/java/org/apache/avalon/activation/appliance/impl
DefaultAppliance.java
Log:
Add NPE test on resolve.
Revision Changes Path
1.12 +12 -5
avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java
Index: DefaultAppliance.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- DefaultAppliance.java 2 Sep 2003 17:45:14 -0000 1.11
+++ DefaultAppliance.java 6 Sep 2003 13:36:35 -0000 1.12
@@ -579,11 +579,15 @@
* @return the resolved object
* @throws Exception if an error occurs
*/
- public Object resolve( Object source, Class[] ref ) throws Exception
+ public Object resolve( final Object source, final Class[] ref ) throws Exception
{
+ if( source == null ) throw new NullPointerException( "source" );
+
+ Class[] refs = ref;
+ if( refs == null ) ref = new Class[0];
+
Object instance = m_lifestyle.resolve( source, ref );
- applyAccessStages( instance, true );
- return instance;
+ return applyAccessStages( instance, true );
}
/**
@@ -595,6 +599,8 @@
public void release( Object source, Object instance )
{
if( instance == null ) return;
+ if( source == null ) throw new NullPointerException( "source" );
+
if( !m_deployment.isEnabled() ) return;
try
@@ -935,7 +941,7 @@
}
}
- private void applyAccessStages( Object instance, boolean flag )
+ private Object applyAccessStages( Object instance, boolean flag )
throws Exception
{
StageDescriptor[] stages = m_model.getType().getStages();
@@ -996,6 +1002,7 @@
}
}
}
+ return instance;
}
private void applyInitialization( Object instance )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]