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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 8u40
    • Fix Version/s: None
    • Component/s: core-libs

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: