Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/classes/java/net/SocketPermission.java
          +++ new/src/share/classes/java/net/SocketPermission.java
↓ open down ↓ 948 lines elided ↑ open up ↑
 949  949  
 950  950          return false;
 951  951      }
 952  952  
 953  953      private boolean compareHostnames(SocketPermission that) {
 954  954          // we see if the original names/IPs passed in were equal.
 955  955  
 956  956          String thisHost = hostname;
 957  957          String thatHost = that.hostname;
 958  958  
 959      -        if (thisHost == null)
      959 +        if (thisHost == null) {
 960  960              return false;
 961      -        else
      961 +        } else if (this.wildcard) {
      962 +            final int cnameLength = this.cname.length();
      963 +            return thatHost.regionMatches(true,
      964 +                                          (thatHost.length() - cnameLength),
      965 +                                          this.cname, 0, cnameLength);
      966 +        } else {
 962  967              return thisHost.equalsIgnoreCase(thatHost);
      968 +        }
 963  969      }
 964  970  
 965  971      /**
 966  972       * Checks two SocketPermission objects for equality.
 967  973       * <P>
 968  974       * @param obj the object to test for equality with this object.
 969  975       *
 970  976       * @return true if <i>obj</i> is a SocketPermission, and has the
 971  977       *  same hostname, port range, and actions as this
 972  978       *  SocketPermission object. However, port range will be ignored
↓ open down ↓ 404 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX