InetAddress.getAllByName() failing on one computer


  • Hi;


    This is happening on just one computer - one of our customers. For the program: 

    Code Snippet

      System.out.println("starting test...");

      System.out.println("calling getLocalHost()");
      InetAddress addr = InetAddress.getLocalHost();
      System.out.println("addr = " + addr);

      System.out.println("calling getHostName()");
      String name = addr.getHostName();
      System.out.println("host name = " + name);

      System.out.println("calling getAllByName()");
      InetAddress[] allIP = InetAddress.getAllByName(name);
      System.out.println("getAllByName = " + allIP);



    We get the output:

    Code Snippet

    starting test...

    calling getLocalHost()

    addr = 12SANW-100140.us01/

    calling getHostName()

    host name = 12SANW-100140.us01

    calling getAllByName()


        at java.net.InetAddress.getAllByName(String hostname)

        at JSharpPart.Class1.test()

        at GetHostTest.Program.Main(String[] args)


    The J# code is called from a C# console application. Any idea why this fails? It should be impossible for it to fail I would think.


    ??? - thanks - dave

    miércoles, 25 de abril de 2007 19:21


  • Found the problem - if the first character of the machine name is a digit then J# assumes it's an IP address, not a name and then throws an exception when it cannot parse 1dave as an IP address.


    Please consider fixing this as it's a hard to resolve bug.


    thanks - dave

    viernes, 27 de abril de 2007 21:10