RFR: 6947916: JarURLConnection does not handle useCaches correctly

Rob McKenna rob.mckenna at oracle.com
Wed Sep 7 13:17:19 UTC 2016


Hi folks,

Looking for a review of this simple enough fix:

http://cr.openjdk.java.net/~robm/6947916/webrev.01/
https://bugs.openjdk.java.net/browse/JDK-6947916

In a nutshell, if multiple URLConnections are made to several files in a single jar, each will use the same backing JarFile object. Unfortunately JarURLConnections connect() method recreates the jarFileURLConnection for a given JarURLConnection using the default value for getUseCaches instead of the *current* value.

In effect this means that jarURLConnection.getUseCaches() may return true before calling connect() and false after. This in turn means that when a JarURLConnection's inputstream is closed, it will believe that caching has been turned off and the underlying jarFile will be closed out from under all other JarURLConnection inputstreams.

	-Rob


More information about the net-dev mailing list