Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4727

NullPointerException in org.apache.cxf.resource.ExtendedURIResolver

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6
    • 2.5.8, 2.6.5, 2.7.2
    • None
    • None
    • Unknown

    Description

      I am seeing an NPE that comes up randomly at org.apache.cxf.resource.ExtendedURIResolver.close(ExtendedURIResolver.java:75).

      I see the method as:

          public void close() {
              while (!resourceOpened.isEmpty()) {
                  try {
                      InputStream in = resourceOpened.pop();
                      in.close(); 
                  } catch (IOException ioe) {
                      // move on...
                  }
              }
          }
      

      The NPE is on the line for "in.close();".

      I have no way of reproducing this, I can just watch our builds fail on rare occasion and our tests do not log the full stack trace.

      Since the catch clause does nothing, would it make sense to guard the close call? Like this:

          public void close() {
              while (!resourceOpened.isEmpty()) {
                  try {
                      InputStream in = resourceOpened.pop();
                      if (in != null) {
                        in.close();
                      }
                  } catch (IOException ioe) {
                      // move on...
                  }
              }
          }
      

      Attachments

        1. CXF-4727.diff
          0.6 kB
          Gary D. Gregory

        Activity

          People

            dkulp Daniel Kulp
            ggregory Gary D. Gregory
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: