diff --git a/src/java.base/share/classes/java/net/HostPortrange.java b/src/java.base/share/classes/java/net/HostPortrange.java
index 5e0696309d0..687bb3737d1 100644
--- a/src/java.base/share/classes/java/net/HostPortrange.java
+++ b/src/java.base/share/classes/java/net/HostPortrange.java
@@ -149,6 +149,9 @@ public int hashCode() {
                         // 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 0cd818ef64b..9c41753c945 100644
--- a/src/java.base/share/classes/java/net/URLPermission.java
+++ b/src/java.base/share/classes/java/net/URLPermission.java
@@ -31,6 +31,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.security.Permission;
+import java.util.Locale;
 
 /**
  * Represents permission to access a resource or set of resources defined by a
@@ -471,7 +472,7 @@ private void parseURI(String url) {
             throw new IllegalArgumentException(
                 "Invalid URL string: \"" + url + "\"");
         }
-        scheme = url.substring(0, delim).toLowerCase();
+        scheme = url.substring(0, delim).toLowerCase(Locale.ROOT);
         this.ssp = url.substring(delim + 1);
 
         if (!ssp.startsWith("//")) {
@@ -493,7 +494,7 @@ private void parseURI(String url) {
             auth = authpath.substring(0, delim);
             this.path = authpath.substring(delim);
         }
-        this.authority = new Authority(scheme, auth.toLowerCase());
+        this.authority = new Authority(scheme, auth);
     }
 
     private String actions() {
diff --git a/test/jdk/java/net/URLPermission/URLPermissionTest.java b/test/jdk/java/net/URLPermission/URLPermissionTest.java
index b170850c702..d31001fd584 100644
--- a/test/jdk/java/net/URLPermission/URLPermissionTest.java
+++ b/test/jdk/java/net/URLPermission/URLPermissionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,9 @@
 
 /**
  * @test
- * @bug 8010464 8027570 8027687 8029354 8114860 8071660 8161291
+ * @bug 8010464 8027570 8027687 8029354 8114860 8071660 8161291 8294378
+ * @run main URLPermissionTest
+ * @run main/othervm -Duser.language=tr URLPermissionTest
  */
 
 public class URLPermissionTest {
@@ -392,7 +394,9 @@ static URLEqualityTest eqtest(String arg1, String arg2, boolean expected) {
         eqtest("http://michael@foo.com/bar","http://michael@foo.com/bar", true),
         eqtest("http://Michael@foo.com/bar","http://michael@goo.com/bar",false),
         eqtest("http://michael@foo.com/bar","http://george@foo.com/bar", true),
-        eqtest("http://@foo.com/bar","http://foo.com/bar", true)
+        eqtest("http://@foo.com/bar","http://foo.com/bar", true),
+        eqtest("http://www.IOU.com", "http://www.iou.com", true),
+        eqtest("HTTPI://www.IOU.com", "httpi://www.iou.com", true)
     };
 
     static Test[] createTests = {