8230415: Avoid redundant permission checking in FilePermissionCollection and SocketPermissionCollection
authorigerasim
Fri, 27 Sep 2019 17:50:09 -0700
changeset 58388 a819c684964b
parent 58387 c5b80da6b561
child 58389 31524b016783
8230415: Avoid redundant permission checking in FilePermissionCollection and SocketPermissionCollection Reviewed-by: mullan
src/java.base/share/classes/java/io/FilePermission.java
src/java.base/share/classes/java/net/SocketPermission.java
--- a/src/java.base/share/classes/java/io/FilePermission.java	Fri Sep 27 18:27:42 2019 +0000
+++ b/src/java.base/share/classes/java/io/FilePermission.java	Fri Sep 27 17:50:09 2019 -0700
@@ -1196,7 +1196,7 @@
                 if ((effective & desired) == desired) {
                     return true;
                 }
-                needed = (desired ^ effective);
+                needed = (desired & ~effective);
             }
         }
         return false;
--- a/src/java.base/share/classes/java/net/SocketPermission.java	Fri Sep 27 18:27:42 2019 +0000
+++ b/src/java.base/share/classes/java/net/SocketPermission.java	Fri Sep 27 17:50:09 2019 -0700
@@ -1433,7 +1433,7 @@
                 if ((effective & desired) == desired) {
                     return true;
                 }
-                needed = (desired ^ effective);
+                needed = (desired & ~effective);
             }
         }
         return false;