RFR: 8318150: StaticProxySelector.select should not throw NullPointerExceptions

David Schlosnagle duke at openjdk.org
Tue Oct 17 03:58:21 UTC 2023


On Mon, 16 Oct 2023 09:21:52 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

> `ProxySelector.select` and `connectFailed` methods should throw `IllegalArgumentException`s on null parameters.
> 
> Additionally, the `select` method doesn't need to be synchronized - the selector is immutable.
> 
> Tier2 green.

src/java.base/share/classes/java/net/ProxySelector.java line 227:

> 225:             }
> 226:             scheme = scheme.toLowerCase(Locale.ROOT);
> 227:             if (scheme.equals("http") || scheme.equals("https")) {

maybe outside the scope of this PR, but could avoid the `toLowerCase`

Suggestion:

            if (scheme.equalsIgnoreCase("http") || scheme.equalsIgnoreCase("https")) {

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16199#discussion_r1361478833


More information about the net-dev mailing list