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

URI: String index out of range: -1 if host component is empty

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • beta
    • generic
    • generic

      import java.net.URI;

      class Test {
          public static void main(String[] argv) throws Exception {
              URI u = new URI("http://://jsn1.ireland/index.html");
          }
      }

      Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
              at java.lang.String.charAt(String.java:433)
              at java.net.URI$Parser.charAt(URI.java:2196)
              at java.net.URI$Parser.parseHostname(URI.java:2659)
              at java.net.URI$Parser.parseServer(URI.java:2532)
              at java.net.URI$Parser.parseAuthority(URI.java:2463)
              at java.net.URI$Parser.parseHierarchical(URI.java:2414)
              at java.net.URI$Parser.parse(URI.java:2371)
              at java.net.URI.<init>(URI.java:413)
              at Test.main(Test.java:6)

            alanb Alan Bateman
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: