Gary Gregory created CXF-4727:
---------------------------------

             Summary: NPE in org.apache.cxf.resource.ExtendedURIResolver
                 Key: CXF-4727
                 URL: https://issues.apache.org/jira/browse/CXF-4727
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.6
         Environment: Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: C:\Java\apache-maven-3.0.4\bin\..
Java version: 1.6.0_35, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_35\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
            Reporter: Gary Gregory


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

I see the method as:

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

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:


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


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to