Uploaded image for project: 'HiveMind'
  1. HiveMind
  2. HIVEMIND-122

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0, 1.1
    • 1.1
    • framework
    • None
    • WAS 5.1 on AIX, IBM JDK 1.4.1, Hivemind

    Description

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

      }

      Attachments

        Activity

          People

            jwcarman James Carman
            frericksm Michael Frericks
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: