You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by "Michael Frericks (JIRA)" <hi...@jakarta.apache.org> on 2005/05/11 13:38:09 UTC

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

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


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

Posted by "James Carman (JIRA)" <hi...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/HIVEMIND-122?page=all ]

James Carman reassigned HIVEMIND-122:
-------------------------------------

    Assign To: James Carman

> 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
>     Assignee: James Carman

>
> 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


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

Posted by "James Carman (JIRA)" <hi...@jakarta.apache.org>.
     [ 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


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

Posted by "James Carman (JIRA)" <hi...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/HIVEMIND-122?page=all ]
     
James Carman resolved HIVEMIND-122:
-----------------------------------

     Resolution: Fixed
    Fix Version: 1.1

> 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
>     Assignee: James Carman
>      Fix For: 1.1

>
> 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