Per-protocol cache setting not working for JAR URLConnection

XMLWordPrintable

    • b159
    • generic
    • generic
    • Verified

        Comment from JDK-8163449 reporter:

        I'm afraid that the current fix is not sufficient for JARUrlConnection.

        The problem is that sun.net.www.protocol.jar.JarURLConnection passes all of the [g|s]et[Default]UseCaches() method calls to the wrapped URLConnection which is an instance of FileURLConnection. This means any attempt to control caching for just JAR URLs fails. "jar" always ends up being treated like "file" which is exactly the case we are trying to avoid. We want "file" to cache for performance but we don't want "jar" to cache so we can avoid the associated file locking issues.

        Simple test here:
        https://github.com/markt-asf/memory-leaks/blob/master/src/org/apache/markt/leaks/net/TestJava9CacheFix.java

        Expected oputput:
        true
        true
        false
        false

        Actual Output :
        true
        true
        true
        true

              Assignee:
              Chris Hegarty
              Reporter:
              Abdul Kolarkunnu (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: