Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8294378

URLPermission constructor exception when using tr locale

XMLWordPrintable

    • b24
    • Verified

        URLPermission class is having an issue , inside it's constructor we are calling .toLowerCase() API which converts the chars depending on the locale , in this case Turkish locale replaces upper case 'I' with a non-ascii lower case 'i'.
        r:~$ cat URLPermissionTest.java
        import java.net.*;
        public class URLPermissionTest {
                public static void main(String[] args) throws Exception {
                String title = "https://IOU.COM";
                URL u = new URL(title);
                URLPermission perm = new URLPermission(title);
            }
        }
        r:~$ java -Duser.language=tr URLPermissionTest
        Exception in thread "main" java.lang.IllegalArgumentException: Invalid
        characters in hostname
              at java.base/java.net.HostPortrange.toLowerCase(HostPortrange.java:189)
              at java.base/java.net.HostPortrange.<init>(HostPortrange.java:150)
              at
        java.base/java.net.URLPermission$Authority.<init>(URLPermission.java:528)
              at java.base/java.net.URLPermission.parseURI(URLPermission.java:496)
              at java.base/java.net.URLPermission.init(URLPermission.java:205)
              at java.base/java.net.URLPermission.<init>(URLPermission.java:185)
              at java.base/java.net.URLPermission.<init>(URLPermission.java:242)
              at URLPermissionTest.main(URLPermissionTest.java:6)

        This issue is reproducible on latest JDK , across all release platforms.

              rwallace Ryan Wallace (Inactive)
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: