RFR: 8147962: URL should handle lower-casing of protocol locale-independently

Claes Redestad claes.redestad at oracle.com
Fri Jan 22 12:29:22 UTC 2016



On 2016-01-22 12:29, Alan Bateman wrote:
>
>
> On 21/01/2016 17:27, Claes Redestad wrote:
>> Hi,
>>
>> using String.toLowerCase() in URL allows some strings to lower-case 
>> to a string that'd be invalid, e.g. "FILE".toLowerCase() -> 
>> "f\u0131le" in turkish locales.
>>
>> This patch suggests using the locale-independent 
>> String.toLowerCase(Locale.ENGLISH) instead, since only a-z and A-Z 
>> are legal alphabeticals according to spec.
>>
>> Webrev: http://cr.openjdk.java.net/~redestad/8147962/webrev.01/
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8147962
> The change to URL looks okay but be warned that URL has bitten the 
> fingers of many that have dared to touch it. So we'll need to keep an 
> eye out for any side effects/bug reports.

I've been questioning my sanity for some time now.

>
> For the test then maybe it could iterate over all locales rather than 
> just test with tr. Also good for the test to run in othervm mode, I 
> can't recall off hand if jtreg resets the locale when in agent VM mode 
> (the default in our testing these days).

Done:

http://cr.openjdk.java.net/~redestad/8147962/webrev.02/

Going over available locales will make the test pass on environments 
that don't happen to have the "tr" locale (and verified this catches the 
issue).

Also switched to Locale.ROOT as Naoto suggested.

Thanks!

/Claes


More information about the net-dev mailing list