[Bug libgcj/25398] .jar files held open twice at runtime

green at redhat dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 17 03:59:00 GMT 2006



------- Comment #1 from green at redhat dot com  2006-01-17 03:59 -------
I discovered why we open all jar files twice.  It happens in
gnu/java/net/protocol/jar/Connection.java.

While searching jar files, we call
gnu.java.net.protocol.jar.Connection.getJarFile().  The first thing this does
is  call gnu.java.net.protocol.jar.Connection.connect().
This, in turn, calls jarFileURLConnection.connect().  jarFileURLConnection is a
gnu.java.net.protocol.file.Connection (if we have a file URL).  This opens the
file.

Then gnu.java.net.protocol.jar.Connection.getJarFile() continues.  This
special-cases local files, and we end up calling new JarFile([filename]).  This
opens the jar file for the second time.

And that's how we end up with two open file descriptors for every jar file we
process.  We should probably figure out a way to avoid doing this.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25398



More information about the Java-prs mailing list