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

DNS resolution is not required explicitly for SocketPermission.implies/equals methods

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Understanding:
      Cause Known
    • CPU:
      x86
    • OS:
      linux, solaris

      Description

      Strictly speaking it is not clear from JDK spec if it is required for any Java implementation
      to make DNS host name resolution to determine result value of SocketPermission.equals/implies methods.

      Let's consider following example:

      -------------------------------------
      import java.net.SocketPermission;

      public class SP01 {
          public static void main (String[] args) {
              SocketPermission sp1 = new SocketPermission(args[0], "connect");
              SocketPermission sp2 = new SocketPermission(args[1], "connect");
              System.out.println("equals-1: " + sp1.equals(sp2));
              System.out.println("equals-2: " + sp2.equals(sp1));
              System.out.println("implies-1: " + sp1.implies(sp2));
              System.out.println("implies-2: " + sp2.implies(sp1));
          }
      }
      ------------------------------------

      If it is executed on JDK-6 with 2 different DNS names representing the same IP address in command line it shows that true is returned always which means coresponding IP adresses are considered inside equals/implies implementation instead of DNS host names.

      I agree it is reasonable but it is not specified explicitly.

      If such behavior is required from any Java implementation (personally me would prefer this option) then it should be specified explcitly.
      It it is up to implementation to either exploit DNS capabilities or resort to literal comparison then such flexibility should be claimed explicitly too.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michaelm Michael McMahon
              Reporter:
              sreznick Sergey Reznick (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Imported:
                Indexed: