Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store specialpermission in field
Browse files Browse the repository at this point in the history
Tim-Brooks committed Jan 17, 2017

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 704561d commit 71f2a32
Showing 5 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@
*/
public final class SocketAccess {

private static SpecialPermission specialPermission = new SpecialPermission();

This comment has been minimized.

Copy link
@jasontedor

jasontedor Jan 17, 2017

Member

I think this should be final and probably named SPECIAL_PERMISSION like it's a constant. This comment applies throughout.


private SocketAccess() {}

public static <T> T doPrivileged(PrivilegedAction<T> operation) {
@@ -54,7 +56,7 @@ public static <T> T doPrivilegedIOException(PrivilegedExceptionAction<T> operati
private static void checkSpecialPermission() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SpecialPermission());
sm.checkPermission(specialPermission);
}
}
}
Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@
*/
public final class Access {

private static SpecialPermission specialPermission = new SpecialPermission();

private Access() {}

public static <T> T doPrivileged(PrivilegedAction<T> operation) {
@@ -62,7 +64,7 @@ public static <T> T doPrivilegedIOException(PrivilegedExceptionAction<T> operati
private static void checkSpecialPermission() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SpecialPermission());
sm.checkPermission(specialPermission);
}
}

Original file line number Diff line number Diff line change
@@ -36,6 +36,8 @@
*/
public final class SocketAccess {

private static SpecialPermission specialPermission = new SpecialPermission();

private SocketAccess() {}

public static <T> T doPrivilegedException(PrivilegedExceptionAction<T> operation) throws StorageException, URISyntaxException {
@@ -67,7 +69,7 @@ public static void doPrivilegedVoidException(StorageRunnable action) throws Stor
private static void checkSpecialPermission() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SpecialPermission());
sm.checkPermission(specialPermission);
}
}

Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@
*/
public final class SocketAccess {

private static SpecialPermission specialPermission = new SpecialPermission();

private SocketAccess() {}

public static <T> T doPrivilegedIOException(PrivilegedExceptionAction<T> operation) throws IOException {
@@ -61,7 +63,7 @@ public static void doPrivilegedVoidIOException(StorageRunnable action) throws IO
private static void checkSpecialPermission() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SpecialPermission());
sm.checkPermission(specialPermission);
}
}

Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@
*/
public final class SocketAccess {

private static SpecialPermission specialPermission = new SpecialPermission();

private SocketAccess() {}

public static <T> T doPrivileged(PrivilegedAction<T> operation) {
@@ -62,7 +64,7 @@ public static void doPrivilegedVoid(StorageRunnable action) {
private static void checkSpecialPermission() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SpecialPermission());
sm.checkPermission(specialPermission);
}
}

0 comments on commit 71f2a32

Please sign in to comment.