RFR [9] 8075139: Restore java.protocol.handler.pkgs to work as a fallback for migration

Paul Sandoz paul.sandoz at oracle.com
Wed Apr 15 14:16:34 UTC 2015


On Apr 15, 2015, at 1:36 PM, Chris Hegarty <chris.hegarty at oracle.com> wrote:
> 
> Paul,
> 
> >
> > Yes, one could use a Pattern.splitAsStream, sorry could not resist :-) assuming this area is not sensitive to bootstrap issues e.g.
> >
> >    hander = p.splitAsStream().map(String::trim).flatMap(this::getHandler).findFirst().orElse(null);
> 
> With the restriction we now have on overriding "core" protocol handlers we can actually use lambda's in this specific code path. I built a webrev based on your suggestion. Not too bad. I marginally favor this over webrev.01 above.
> 
> http://cr.openjdk.java.net/~chegar/8075139/webrev.02/src/java.base/share/classes/java/net/URL.java.sdiff.html
> 

Looks ok. 

I marginally prefer using flatMap rather than map/filter e.g. change getHandler to return Stream< URLStreamHandler> and change the last line to be "return Stream.ofNullable(handle). Up to you. 

If you stick with what you have perhaps consider changing "h -> h != null" to "Objects::nonNull".

Paul.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.openjdk.java.net/pipermail/net-dev/attachments/20150415/37c19499/signature.asc>


More information about the net-dev mailing list