----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

On Tue, 18 Jan 2000, Hutchison, Jeff wrote:

> I've got an application in production that's worked fine in JServ 1.0
> through 1.1b3 but stopped working in 1.1.  Here's the relevent code
> snippet that's failing:
> 
> SISSystem.class.getResourceAsStream( "sis.properties" ) // returns null!
> 
> where "sis.properties" is in a repository jar file in the same package as
> the class SISSystem.  SISSystem is not a servlet, but a utility class
> used by one.
> 
> Since SISSystem is in a repository and not in the system classpath, I
> assume the AdaptiveClassLoader is attempting to load the properties file.
> The changelog implies that the code for loading resources was patched to
> accomplish what I've been doing for months already with this properties
> file.  Is the patch broken or am I loading resources from a repository jar
> incorrectly?

I've found a bug in AdaptiveClassLoader.loadResourceFromZipfile. This
method returns an InputStream with zipfile.getInputStream from within the
main block of a try/catch/finally statement and then calls zipfile.close
from within the finally block of the same.  When I commented out the
finally block of the try/catch/finally, it works fine.  (This is how it
was up through 1.1b3.)

Grossly paraphrased it's doing this:

try {
        ...
        return zipfile.getInputStream(entry);
        ...
} catch (IOException ex) {
        return null;
} finally {
        ...
        zipfile.close();
        ...
}



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to