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

Permissions/getLocalHostTest test fails with java.lang.SecurityException

XMLWordPrintable

    • b64
    • solaris_11

      Permissions/getLocalHostTest

      InetAddress.getLocalHost().getHostAddress() call on solaris 11 always returns loopback address 127.0.0.1.

      Tried running the sample program with and without security manager. In both cases, it returns the loopback address. From Java documentation -

      --------------------------------------------------------------------------------------------
      public static InetAddress getLocalHost()
                                      throws UnknownHostException
      Returns the local host.
      If there is a security manager, its checkConnect method is called with the local host name and -1 as its arguments to see if the operation is allowed. If the operation is not allowed, an InetAddress representing the loopback address is returned.

      Returns:
      the IP address of the local host.
      --------------------------------------------------------------------------------------------

            khazra Kurchi Subhra Hazra
            rhalade Rajan Halade
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: