You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by "James Carman (JIRA)" <hi...@jakarta.apache.org> on 2005/05/18 23:23:51 UTC

[jira] Commented: (HIVEMIND-122) URLResource: IBM JDK 1.4.1 and java.net.URL.openStream causes NPE

     [ http://issues.apache.org/jira/browse/HIVEMIND-122?page=comments#action_65713 ]
     
James Carman commented on HIVEMIND-122:
---------------------------------------

I don't know if I would consider this a bug in HiveMind or the JDK.  The JavaDocs don't mention anything about a null return value being acceptable (doesn't mean that it isn't).  We can certainly code around this and I will try to devise a test case that exhibits this behavior.

> 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: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org