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

URISyntaxException when non-alphanumeric characters are present in scope_id

    Details

    • Subcomponent:
    • Resolved In Build:
      b48
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        SYNOPSIS
        URISyntaxException thrown when non alpha-numeric characters are used in the scope_id field along with the IPv6 literal

        OPERATING SYSTEM(S)
        All Platforms. The problem is platform independent.

        FULL JDK VERSION(S)
        Sun Java 5 and Sun Java 6 (All releases)

        PROBLEM DESCRIPTION
        Stack Trace:-

        java.net.URISyntaxException: Illegal character in scope id at index 37: http://[fe80::c00:16fe:cebe:3214%eth1.12]:10/
        at java.net.URI$Parser.fail(URI.java:2821)
        at java.net.URI$Parser.checkChars(URI.java:2994)
        at java.net.URI$Parser.parseServer(URI.java:3196)
        at java.net.URI$Parser.parseAuthority(URI.java:3128)
        at java.net.URI$Parser.parseHierarchical(URI.java:3070)
        at java.net.URI$Parser.parse(URI.java:3026)
        at java.net.URI.<init>(URI.java:675)
        at URIsyntaxexception.main(URIsyntaxexception.java:8)

        Expected behaviour:- No exception should be thrown

        Observed behaviour:- URISyntaxException is thrown

        Links to relevant specification/documentation

        1. http://java.sun.com/javase/6/docs/api/java/net/URI.html

        2. http://java.sun.com/javase/6/docs/api/java/net/Inet6Address.html#scoped

        3. http://www.ietf.org/rfc/rfc2373.txt

        4. http://www.ietf.org/rfc/rfc2732.txt

        5. http://www.ietf.org/rfc/rfc2396.txt

        New problem or regression
        Existing problem with URI for all Java releases

        TESTCASE

        import java.net.*;

        public class URIsyntaxexception {
        public static void main(String[] arg) {


        try {
        new URI("http", null, "fe80::c00:16fe:cebe:3214%eth1.12", 10, "/", null, null);
        } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        }

        }
        }

        REPRODUCTION INSTRUCTIONS
        Compile and execute the above testcase to see the exception thrown
         
        If the scope_id does not contain any non-alphanumeric characters the testcase runs fine. There are no issues.

        SUGGESTED FIX
        None

        OTHER INFORMATION
        The same scope_id with IPv6 literal to URL works just fine.

        import java.net.*;

        public class URLScopeID {
        public static void main(String[] arg) {


        try {
        new URL("http", "fe80::c00:16fe:cebe:3214%eth1.12", 10, "RandomFile.txt" );
        } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        }

        }
        }

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  kshefov Konstantin Shefov
                  Reporter:
                  dkorbel David Korbel (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: