8221518: Normalize normalization

Reviewed-by: chegar, igerasim, ahgross, rhalade
This commit is contained in:
Daniel Fuchs 2019-04-10 15:49:24 +01:00
parent 657f017400
commit c9da623b6f
6 changed files with 233 additions and 7 deletions

View file

@ -516,12 +516,15 @@ public abstract class URLStreamHandler {
* different from this one
* @since 1.3
*/
protected void setURL(URL u, String protocol, String host, int port,
protected void setURL(URL u, String protocol, String host, int port,
String authority, String userInfo, String path,
String query, String ref) {
if (this != u.handler) {
throw new SecurityException("handler for url different from " +
"this handler");
} else if (host != null && u.isBuiltinStreamHandler(this)) {
String s = IPAddressUtil.checkHostString(host);
if (s != null) throw new IllegalArgumentException(s);
}
// ensure that no one can reset the protocol on a given URL.
u.set(u.getProtocol(), host, port, authority, userInfo, path, query, ref);