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:


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.


More information about the net-dev mailing list