Code review request 7183373: URLClassloader.close() does not close JAR files whose resources have been loaded via getResource()

Shirish Kuncolienkar shirishk at linux.vnet.ibm.com
Thu Aug 23 10:50:23 PDT 2012


Could I get the change reviewed please

This behavior is seen on Windows.
Logic in URLClassPath.getLoader() does not take care of an URL which 
looks like "jar:file:/C:/test/xyz.jar!/". The logic ends up choosing a 
FileLoader instead of a JarLoader.  JarLoader has provision for closing 
file handles, so choosing a JarLoader will solve the problem. Secondly 
the constructor of JarLoader blindly adds a prefix and suffix to the 
provided URL to make it look like a jar URL. Changed the code here to 
conditionally append/prepend

The change set can be found at 
http://cr.openjdk.java.net/~shirishk/7183373/webrev.0/

-Shirish




More information about the net-dev mailing list