-
Bug
-
Resolution: Fixed
-
P3
-
7u85, 8u66, 9
-
b104
-
generic
-
generic
-
Verified
According to the RFC, URL protocols are to be consumed case-insensitively, while a producer needs to use lowercase alphabetic characters, defined by the RFC as a-z. URL's with uppercase characters in the protocol are allowed as long as they are a-z / A-Z, e.g., FILE:///, Jar:/...
Using some locales, e.g., turkish, consuming an upper-case protocol such as FILE will be lower-cased by the current URL implementation to "f\u0131le", which is illegal and will throw a MalformedURLException on most versions of Java:
Locale.setDefault(new Locale("tr"));
new URL("FILE:///tmp");
The fix seems to be to consistently use String.toLowerCase(Locale.ENGLISH) to lower-case the protocol.
Additionally enforcing lower-case across URL methods would allow using case-sensitive String.equals across the code, which avoids penalizing the common path.
Using some locales, e.g., turkish, consuming an upper-case protocol such as FILE will be lower-cased by the current URL implementation to "f\u0131le", which is illegal and will throw a MalformedURLException on most versions of Java:
Locale.setDefault(new Locale("tr"));
new URL("FILE:///tmp");
The fix seems to be to consistently use String.toLowerCase(Locale.ENGLISH) to lower-case the protocol.
Additionally enforcing lower-case across URL methods would allow using case-sensitive String.equals across the code, which avoids penalizing the common path.