8230415: Avoid redundant permission checking in FilePermissionCollection and SocketPermissionCollection
Reviewed-by: mullan
--- 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;