On Tue, 7 Dec 2021 08:07:22 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> All this manually written code actually can be replaced with single >> String.isBlank() call. >> `file` variable is guaranteed to be non-null. > > src/java.base/share/classes/sun/net/www/protocol/mailto/Handler.java line 125: > >> 123: * Let's just make sure we DO have an Email address in the URL. >> 124: */ >> 125: if (file.isBlank()) > > The mail protocol handler is a legacy protocol handler and I don't know if > there is good test coverage. The change proposed here changes the exception > from RuntimeException to NPE when there isn't a file component in the URL. > Neither is specified by URLStreamHandler.parseURL so I suspect there may be > follow-on issues to clarify the spec on several points. `file` can't be `null` here. It's either empty string, or result of String.substring (which is also guarantee to be non-null). Check code before this line: https://github.com/openjdk/jdk/blob/07669e3bc65b1728d784e21ec83b437374f9fa19/src/java.base/share/classes/sun/net/www/protocol/mailto/Handler.java#L121-L125 IDEA confirms that  ------------- PR: https://git.openjdk.java.net/jdk/pull/6372