JDK-8064924 : Update java.net.URL to work with modules
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-11-14
  • Updated: 2018-11-21
  • Resolved: 2015-02-23
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 9
9 b53Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
This is phase 1, of getting java.net.URL work with modules. 

Being able to effectively specify URL protocol handler factories as fully qualified class names, through the 'java.protocol.handler.pkgs' system property is problematic. It requires the protocol handler factory implementation class to be public and accessible, as the current implementation tries to instantiate it through core reflection. Since the protocol handler factory must be an implementation of a URLStreamHandlerFactory, it lends itself to being retrofitted with a ServiceLoader lookup. Note, the 'java.protocol.handler.pkgs' system property mechanism predates ServiceLoader. URL protocol handlers would most likely have used service loader if it were available at the time.

Some URL protocol handlers are fundamental to the platform itself, like 'file' and 'jar', it is not appropriate to attempt a service loader lookup for these, as they may lead to recursive initialization issues. However, Java Plugin, Webstart, and possibly other containers, do override the 'jar' handler. A new API should be provided for this purpose. Providing an API solution should not interfere with system initialization as it will only be called after the system comes up and user code is executing. 

The 'file' protocol handler factory will no longer be overridable, and the system property will no longer be consulted. 
Comments
After the integration of this issue into a promoted build, it quickly became clear that the 'java.protocol.handler.pkgs' system property is required. JDK-8075139 was filed to restore it.
21-04-2015

Pertinent details for the release note: "Applications setting the 'java.protocol.handler.pkgs' system property will no longer have their protocol handlers found at runtime. No error or exception will be thrown. They should instead install additional protocol providers as services, see java.net.spi.URLStreamHandlerProvider for details."
24-02-2015