RFR: 6947916: JarURLConnection does not handle useCaches correctly

Chris Hegarty chris.hegarty at oracle.com
Thu Sep 8 19:40:12 UTC 2016


> On 7 Sep 2016, at 14:17, Rob McKenna <rob.mckenna at oracle.com> wrote:
> 
> 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

I think that the source changes are good, but the tests has a
reference to a shell script that is absent. Also, could the test just
create a simple jar file, rather than checking in a binary artifact.

-Chris.

> 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