JDK-8075139 : Restore java.protocol.handler.pkgs to work as a fallback for migration
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 9
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2015-03-13
  • Updated: 2017-05-17
  • Resolved: 2015-04-21
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 b62Fixed
Related Reports
Relates :  
Relates :  
Description
URL was updated via JDK-8064924 to use ServiceLoader and work cleanly with modules. As part of this then the JDK 1.0 era mechanism using the java.protocol.handler.pkgs property was removed.

We have not seen much usage of legacy mechanism in a long time but there may be some large projects depending on it and the transition to move the custom protocol handler to a service provider may be disruptive and delay adoption of JDK 9.

This new bug is submitted to track re-visiting this part of the solution. One of the primary motivations for removing the legacy mechanism is that it wouldn't work during VM startup and couldn't be used to override core protocols. One approach is to have it work as a fallback to the ServiceLoader mechanism. If not found via ServiceLoader then use the search the packages in the property value. It may be that this mechanism should only work for protocol handlers that aren't packaged as modules.
Comments
The work done as part of JDK-8064924 to introduce a new service type, java.net.spi.URLStreamHandlerProvider, provides a clean provider mechanism that will work well with modules. That part of the change should remain, but the removal of support to find handlers through the java.protocol.handler.pkgs system property is problematic, and could be an impediment to moving to JDK 9. Applications making use of custom protocol handlers and not packaged as modules should continue to be able to use this property. The proposal is to reinstate the JDK 8 specification about java.protocol.handler.pkgs in java.net.URL.<init>, that documents the search order for handlers. Additionally reinstate the JDK 8 implementation code to search the system property after the service loader lookup.
14-04-2015