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

InetAddress.getLocalHost throws UnknownHostException on java7u5 on OSX

    Details

    • Subcomponent:
    • Resolved In Build:
      b113
    • CPU:
      x86
    • OS:
      os_x

      Backports

        Description

        FULL PRODUCT VERSION :
        $ java -version
        java version "1.7.0_05"
        Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
        Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        OSX 10.7.4

        $ uname -a
        Darwin d9y8kt71.corp.skytide.com 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr 9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64


        EXTRA RELEVANT SYSTEM CONFIGURATION :
        $ hostname
        d9y8kt71.corp.skytide.com
        $ hostname -f
        d9y8kt71.corp.skytide.com


        A DESCRIPTION OF THE PROBLEM :
        Run the following test driver program on Oracle java7u5 on OSX. It throws an exception even though it should not. Note that the very same program runs fine on java6u33 on the very same OSX host and config.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run the following test driver program on Oracle java7u5 on OSX.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The program should print something like d9y8kt71.corp.skytide.com

        ACTUAL -
        [hoschek /sky/cdnapp/build/classes] java -cp . HostNameTest
        Exception in thread "main" java.net.UnknownHostException: d9y8kt71.corp.skytide.com: d9y8kt71.corp.skytide.com: nodename nor servname provided, or not known
        at java.net.InetAddress.getLocalHost(InetAddress.java:1438)
        at HostNameTest.main(HostNameTest.java:8)
        Caused by: java.net.UnknownHostException: d9y8kt71.corp.skytide.com: nodename nor servname provided, or not known
        at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258)
        at java.net.InetAddress.getLocalHost(InetAddress.java:1434)
        ... 1 more


        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        See full stack trace above.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------

        import java.net.InetAddress;
        import java.net.UnknownHostException;

        public class HostNameTest {

        public static void main(String[] args) throws UnknownHostException {
        String version = System.getProperty("java.version");
        System.out.println(version + " getHostName(): " + InetAddress.getLocalHost().getHostName());
        System.out.println(version + " www.google.com.getHostName(): " + InetAddress.getByName("www.google.com").getHostName());
        }
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        We are not aware of any workaround.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  robm Robert Mckenna
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  13 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: