bloritsch 2003/05/29 12:56:23
Modified: fortress/src/tools/org/apache/avalon/fortress/tools
Component.java
Log:
Fix NullPointerException
Revision Changes Path
1.10 +16 -6
avalon-excalibur/fortress/src/tools/org/apache/avalon/fortress/tools/Component.java
Index: Component.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/fortress/src/tools/org/apache/avalon/fortress/tools/Component.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Component.java 29 May 2003 19:29:32 -0000 1.9
+++ Component.java 29 May 2003 19:56:23 -0000 1.10
@@ -141,9 +141,8 @@
{
JavaClass currClass = m_javaClass;
- while ( ! currClass.getFullyQualifiedName().equals("java.lang.Object") )
+ while ( currClass != null && discoverDependencies( currClass ) )
{
- discoverDependencies( currClass );
currClass = currClass.getSuperJavaClass();
}
}
@@ -153,8 +152,10 @@
*
* @param fromClass The JavaClass object to gather the dependency set from.
*/
- private void discoverDependencies( final JavaClass fromClass )
+ private boolean discoverDependencies( final JavaClass fromClass )
{
+ boolean isSuccessful = true;
+
JavaMethod[] methods = fromClass.getMethods();
for ( int i = 0; i < methods.length; i++ )
{
@@ -169,11 +170,20 @@
dependencies[d].getNamedParameter( ATTR_TYPE ) );
//String optional =
dependencies[d].getNamedParameter("optional");
- m_dependencyNames.add( type );
+ if ( null == type )
+ {
+ isSuccessful = false;
+ }
+ else
+ {
+ m_dependencyNames.add( type );
+ }
}
}
}
}
+
+ return isSuccessful;
}
private void discoverNameInfo()
@@ -354,7 +364,7 @@
*/
protected String resolveClassName( final JavaSource sourceCode, final String
serviceName )
{
- if ( null == sourceCode ) throw new NullPointerException( "sourceCode" );
+ if ( null == sourceCode ) return null;
if ( null == serviceName ) throw new BuildException( "You must specify the
service name with the \"type\" parameter" );
String className = stripQuotes( serviceName );
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]