diff --git a/src/java.base/share/classes/java/net/HostPortrange.java b/src/java.base/share/classes/java/net/HostPortrange.java index 687bb3737d1..5e0696309d0 100644 --- a/src/java.base/share/classes/java/net/HostPortrange.java +++ b/src/java.base/share/classes/java/net/HostPortrange.java @@ -149,9 +149,6 @@ class HostPortrange { // regular domain name hoststr = toLowerCase(hoststr); } - } else { - // regular domain name - hoststr = toLowerCase(hoststr); } } hostname = hoststr; diff --git a/src/java.base/share/classes/java/net/URLPermission.java b/src/java.base/share/classes/java/net/URLPermission.java index 4ee5cddaff8..605edf9e92c 100644 --- a/src/java.base/share/classes/java/net/URLPermission.java +++ b/src/java.base/share/classes/java/net/URLPermission.java @@ -494,7 +494,7 @@ public final class URLPermission extends Permission { auth = authpath.substring(0, delim); this.path = authpath.substring(delim); } - this.authority = new Authority(scheme, auth); + this.authority = new Authority(scheme, auth.toLowerCase(Locale.ROOT)); } private String actions() { diff --git a/test/jdk/java/net/URLPermission/URLPermissionTest.java b/test/jdk/java/net/URLPermission/URLPermissionTest.java index d31001fd584..834ad8353b2 100644 --- a/test/jdk/java/net/URLPermission/URLPermissionTest.java +++ b/test/jdk/java/net/URLPermission/URLPermissionTest.java @@ -402,7 +402,9 @@ public class URLPermissionTest { static Test[] createTests = { createtest("http://user@foo.com/a/b/c"), createtest("http://user:pass@foo.com/a/b/c"), - createtest("http://user:@foo.com/a/b/c") + createtest("http://user:@foo.com/a/b/c"), + createtest("http://foo_bar"), + createtest("http://foo_bar:12345") }; static boolean failed = false;