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

StringIndexOutOfBoundsException thrown in InetAddress.getAllByname()

    XMLWordPrintable

Details

    • hopper
    • generic
    • generic
    • Verified

    Description

      Running the following code results in an unexpected exception:

      public class Test {
          public static void main(String args[]) throws Exception {
      InetAddress[] l = InetAddress.getAllByName(args[0]);
      System.err.println("l.length = " + l.length);
      System.err.println(l[0]);
          }
      }


      $ java Test "[]"
      Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0
              at java.lang.String.charAt(String.java:438)
              at java.net.InetAddress.getAllByName(InetAddress.java:868)
              at Test.main(Test.java:5)

      Attachments

        Activity

          People

            jccollet Jean-Christophe Collet (Inactive)
            jccollet Jean-Christophe Collet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: