URLResource: IBM JDK 1.4.1 and java.net.URL.openStream causes NPE
-----------------------------------------------------------------

         Key: HIVEMIND-122
         URL: http://issues.apache.org/jira/browse/HIVEMIND-122
     Project: HiveMind
        Type: Bug
  Components: framework  
    Versions: 1.0, 1.1    
 Environment: WAS 5.1 on AIX, IBM JDK 1.4.1, Hivemind 
    Reporter: Michael Frericks


Situation:

The BuilderFactory fails to set the message-property. 

Reason:
While looping over all possible localized names of the message resource
there is a uncaught NPE for not existing resources.

In the method org.apache.hivemind.util.URLResource#getResourceURL()
the call of java.net.URL#openStream() is expected to throw an 
IOException if the Resource does not exist.

But in described environment the method returns silently null and
then the next statement causes an NPE which is not caught.


Solution:

In the method org.apache.hivemind.util.URLResource#getResourceURL()
change:  

...
try
{
  InputStream stream = test.openStream();
  if (stream != null)

  stream.close();
  _url = test;
}

to:

...
try
{
  InputStream stream = test.openStream();
  if (stream != null)
  {
    stream.close();
    _url = test;
  }
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to