tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Hayden <>
Subject PATCH
Date Thu, 11 Jan 2001 19:50:10 GMT
In developing a servlet, I came across a bug in the tomcat code. The problem
was that the server was leaking file handle resources. I could run my
servlet a couple of times, but then it would cause an OutOf Memory
exception. The problem was in the (partial path here)
org/apache/tomcat/loader/ class. Specifically, in
the getResource(String name) method, a ZipFile object is instantiated. This
opens a zip file. The file is never closed. A source code snippet follows
with the fix in bold: 
   // a jar:-URL *could* change even between minor releases, but 
   // didn't between JVM's 1.1.6 and 1.3beta. Tested on JVM's from 
   // IBM, Blackdown, Microsoft, Sun @ Windows and Sun @ Solaris 
   try { 
   ZipFile zf = new ZipFile(file.getAbsolutePath()); 
   ZipEntry ze = zf.getEntry(name); 

   zf.close() ; 
   if (ze != null) { 

A small oversight, but this was a show stopper for me. I'm happy to
contribute something back for the use of this software. 
Kindest regards, 
William D. Hayden 

View raw message