JDK-8174803 : Documentation of URLStreamHandlerFactory.createURLStreamHandler() doesn't mention null return value
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2017-02-12
  • Updated: 2017-03-08
  • Resolved: 2017-02-13
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE REQUEST :
From the usage of java.net.URLStreamHandlerFactory.createURLStreamHandler() in java.net.URL it is clear that createURLStreamHandler() is supposed to return null when it doesn't know how to handle the protocol. The documentation doesn't mention that; it says that it must return a URLStreamHandler instance for the specified protocol.

JUSTIFICATION :
The current documentation implies that a URLStreamHandlerFactory must return URLStreamHandler for every possible protocol, which doesn't make sense.



Comments
As part of JDK-8064924, URLStreamHandlerFactory::createURLStreamHandler was updated to document the behavior of a null return value. The change is small but still constitutes change in specification, so is not something that can be backported to a previous release.
13-02-2017

The @return reads "a URLStreamHandler for the specific protocol, or null if this factory cannot create a handler for the specific protocol" so this is not an issue in >= 9.
13-02-2017