crafterm 2003/07/02 05:28:48
Modified: fortress/container/src/impl/org/apache/avalon/fortress/impl/role
ServiceMetaManager.java
Log:
getResourceAsStream() returns null if the resource can't be loaded, I've
added a test for this to prevent Properties.load() from throwing an NPE if
it's given 'null' as an input parameter.
BTW - couldn't we use the source resolver for this ?
Revision Changes Path
1.9 +17 -2
avalon/fortress/container/src/impl/org/apache/avalon/fortress/impl/role/ServiceMetaManager.java
Index: ServiceMetaManager.java
===================================================================
RCS file:
/home/cvs/avalon/fortress/container/src/impl/org/apache/avalon/fortress/impl/role/ServiceMetaManager.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ServiceMetaManager.java 28 May 2003 12:30:59 -0000 1.8
+++ ServiceMetaManager.java 2 Jul 2003 12:28:42 -0000 1.9
@@ -56,6 +56,7 @@
import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.*;
@@ -226,7 +227,21 @@
try
{
- meta.load( getLoader().getResourceAsStream( getMetaFile( implementation
) ) );
+ final InputStream stream =
+ getLoader().getResourceAsStream( getMetaFile( implementation ) );
+
+ if ( stream != null )
+ {
+ meta.load( stream );
+ }
+ else
+ {
+ getLogger().error(
+ "Meta information for " + implementation +
+ " unavailable, skipping this class."
+ );
+ return;
+ }
}
catch ( IOException ioe )
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]