JDK-8010282 : sun.net.www.protocol.jar.JarFileFactory.close(JarFile) should be thread-safe
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-03-19
  • Updated: 2014-02-10
  • Resolved: 2013-03-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u40Fixed 8 b84Fixed
Description
JarFileFactory has two Maps that it uses to implement caching of jar files. Access to these maps should always be done while holding the instance lock, as multiple threads can be simultaneously updating the maps.

The close method was added some time after the original implementation, and it looks like the locking was forgotten. Also, the locking strategy assumes that JarFileFactory is a singleton. It could be reworked to make it more robust.