RFR: 8294626: Improve URL protocol lower casing [v3]
Daniel Fuchs
dfuchs at openjdk.org
Fri Sep 30 11:46:40 UTC 2022
On Fri, 30 Sep 2022 11:43:15 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> Move a simple utility method from `URL` to the shared `sun.net.util.URLUtil` class, rename it for clarity and enhance it so that it returns the string literal if the protocol matches one of the tested variants. This helps reduce dependencies from bootstrap code on `Locale` while improving the performance and allocation pressure in certain applications.
>
> Claes Redestad has updated the pull request incrementally with two additional commits since the last revision:
>
> - Cleanups
> - Revert accidental import mangling
Changes requested by dfuchs (Reviewer).
src/java.base/share/classes/java/net/URL.java line 35:
> 33: import java.security.AccessController;
> 34: import java.security.PrivilegedAction;
> 35: import java.util.*;
Could we avoid the wildcards? Thanks!
src/java.base/share/classes/java/net/URL.java line 46:
> 44: import jdk.internal.misc.VM;
> 45: import sun.net.util.IPAddressUtil;
> 46: import sun.net.util.URLUtil;
No longer needed.
src/java.base/share/classes/java/net/URL.java line 439:
> 437: }
> 438:
> 439: protocol = URLUtil.lowerCaseProtocol(protocol);
Maybe we could keep the name 'toLowerCase' in this file
src/java.base/share/classes/java/net/URLConnection.java line 47:
> 45: import java.security.AccessController;
> 46:
> 47: import sun.net.util.URLUtil;
No longer needed?
src/java.base/share/classes/sun/net/util/URLUtil.java line 61:
> 59: protocol = protocol.toLowerCase();
> 60: }
> 61: strForm.append(protocol.toLowerCase());
toLowerCase() should be removed here now?
-------------
PR: https://git.openjdk.org/jdk/pull/10506
More information about the net-dev
mailing list