Current fix tries to tackle an issue with URL connection referencing 
non-existing Jar file entries:
If an entry that doesn't exist is specified in an URL connection the underlying 
Jar file is still cached even if an exception is thrown after that. Such 
behavior prevents the caller, for instance, a `URLClassLoader`, from closing a 
Jar file.

The proposed fix checks if entry exists before caching a Jar file (only for 
cases with enabled caching):
- If entry exists - jar file is cached if it wasn't cached before
- If entry doesn't exist and jar file wasn't cached before - jar file is closed 
and exception is thrown
- If entry doesn't exist and jar file was cached before - jar file is kept 
cached and exception is thrown


The following tests have been used to verify the fix:
- New regression tests
- ``:jdk_core:`` tests
- `api/java_util`,`api/java_net` JCK tests

-------------

Commit messages:
 - Merge remote-tracking branch 'origin' into JDK-8264048
 - 8264048: Fix caching in Jar URL connections when an entry is missing

Changes: https://git.openjdk.java.net/jdk/pull/3263/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3263&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264048
  Stats: 551 lines in 7 files changed: 525 ins; 2 del; 24 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3263.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3263/head:pull/3263

PR: https://git.openjdk.java.net/jdk/pull/3263

Reply via email to