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

InetAddress.getAllByName() and InetAddress.getByName() fails

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.0
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      sparc
    • OS:
      solaris_8
    • Verification:
      Verified

      Description

      InetAddress.getAllByname() fails when its been called
      InetAddress.getAllByName(InetAddress.getHostName()) and host name is an IP address Solaris 8 machine.

      InetAddress.getByName() also fails when its called in the same way.

      How to reproduce this:

      The following code is throwing exception at
         " InetAddress[] iadrtest = InetAddress.getAllByName(iadr[i].getHostName()); "
         
         statement when I executed this script as
         
         % java GetIP ff15::1234:1234:1234:1234
         
         
         Exception Message:
              exp mesg [ff15::1234:1234:1234:1234]
         
      import java.net.*;
      import java.io.*;

      public class GetIP {


         public static void main(String[] arg)
         {
             try {
               InetAddress[] iadr = InetAddress.getAllByName(arg[0]);
              System.out.println("iadr length " + iadr.length);

               for(int i=0; i< iadr.length; i++)
               {
                System.out.println("ip address : " + iadr[i].getHostAddress());
                System.out.println(" Host Name :" + iadr[i].getHostName());
                //System.out.println("family " + iadr[i].getFamily());
                System.out.println("Host aadd byte arr " + iadr[i].getAddress());
                if(iadr[i] instanceof Inet4Address)
                      System.out.println("v4 address");
                if(iadr[i] instanceof Inet6Address)
                      System.out.println("v6 address ");

                if(!iadr[i].isMCOrgLocal()) {
                    System.out.println("NOt org local scope");
                 }
                InetAddress[] iadrtest = InetAddress.getAllByName(iadr[i].getHostName());
                System.out.println("working....");
               }
              InetAddress iad = InetAddress.getByName(arg[0]);
              System.out.println("ip of that host : " + iad.getHostAddress());
              System.out.println("inet add tostring : " + iad);
            } catch(Exception exp) {
               System.out.println("exp mesg " + exp.getMessage());
            }
         } // End of main

      }
       

        Attachments

          Activity

            People

            Assignee:
            ywangsunw Yingxian Wang (Inactive)
            Reporter:
            vakellasunw Venkata Akella (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: