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

InetAddress.getLocalHost().getHostName() behaving differently in JDK8

XMLWordPrintable

      InetAddress.getLocalHost().getHostName() is called in oraclepki.jar to get
      the hostname. This API returns different hostnames when it is run on Java6/7
      and Java8. This difference in behavior is causing product functionality
      to break.

      The following output is from test enviroment -

      $ ./scripts/runGetHostNameUtilWithJava8.sh
      Running with Java 1.8.0_25
      Using InetAddress.getLocalHost().getHostName() the host name is: testhost
      Using InetAddress.getLocalHost().toString() the host name is: testhost/10.10.10.10
      Stripped host using InetAddress.getLocalHost().toString() the host name is: testhost

      $ ./scripts/runGetHostNameUtilWithJava7.sh
      Running with Java 1.7
      Using InetAddress.getLocalHost().getHostName() the host name is: test.domain.com
      Using InetAddress.getLocalHost().toString() the host name is: test.domain.com/10.10.10.10
      Stripped host using InetAddress.getLocalHost().toString() the host name is: test.domain.com

            robm Robert Mckenna
            shadowbug Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: