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

REGRESSION: InetAddress.getAllByName accepts badly formed address

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 5.0
    • core-libs
    • beta
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0_03"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
      Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP Professional Ver 5.1 Build 2600 Service Pack 2

      A DESCRIPTION OF THE PROBLEM :
      The getAllByName used to throw a java.net.UnknownHostException for a badly formed address, now it doesn't.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run example code.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I would like to see:

      java.net.UnknownHostException: 192.168.1.220...: 192.168.1.220...
              at java.net.InetAddress.getAllByName0(InetAddress.java:999)
              at java.net.InetAddress.getAllByName0(InetAddress.java:969)
              at java.net.InetAddress.getAllByName(InetAddress.java:963)
              at GetAllByName.main(GetAllByName.java:8)
      TEST PASSED

      ACTUAL -
      getAllByName accepted bad address

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.net.InetAddress;

      public class GetAllByName {

          public static void main(String[] args) {
              boolean fail = false;
              try {
                  InetAddress.getAllByName("192.168.1.220...");
              } catch (Exception e) {
                  fail = true;
                  e.printStackTrace();
              }
              if (!fail) {
                  System.err.println("getAllByName accepted bad address");
                  System.exit(1);
              } else {
                  System.out.println("TEST PASSED");
              }
          }
      }
      ---------- END SOURCE ----------

      Release Regression From : 1.4.2_08
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.
      ###@###.### 2005-07-13 10:55:42 GMT

            yuwangsunw Yujiang Wang (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: