src/share/classes/java/net/SocketPermission.java

Print this page

        

@@ -954,15 +954,21 @@
         // we see if the original names/IPs passed in were equal.
 
         String thisHost = hostname;
         String thatHost = that.hostname;
 
-        if (thisHost == null)
+        if (thisHost == null) {
             return false;
-        else
+        } else if (this.wildcard) {
+            final int cnameLength = this.cname.length();
+            return thatHost.regionMatches(true,
+                                          (thatHost.length() - cnameLength),
+                                          this.cname, 0, cnameLength);
+        } else {
             return thisHost.equalsIgnoreCase(thatHost);
     }
+    }
 
     /**
      * Checks two SocketPermission objects for equality.
      * <P>
      * @param obj the object to test for equality with this object.