提交 1c18c8e5 编写于 作者: M mullan

7189490: More improvements to DomainCombiner checking

Reviewed-by: ahgross, jdn, vinnie
上级 bc38b897
...@@ -290,11 +290,11 @@ public final class AccessController { ...@@ -290,11 +290,11 @@ public final class AccessController {
*/ */
public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action) { public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action) {
DomainCombiner dc = null;
AccessControlContext acc = getStackAccessControlContext(); AccessControlContext acc = getStackAccessControlContext();
if (acc == null || (dc = acc.getAssignedCombiner()) == null) { if (acc == null) {
return AccessController.doPrivileged(action, acc); return AccessController.doPrivileged(action);
} }
DomainCombiner dc = acc.getAssignedCombiner();
return AccessController.doPrivileged(action, preserveCombiner(dc)); return AccessController.doPrivileged(action, preserveCombiner(dc));
} }
...@@ -386,11 +386,11 @@ public final class AccessController { ...@@ -386,11 +386,11 @@ public final class AccessController {
public static <T> T doPrivilegedWithCombiner public static <T> T doPrivilegedWithCombiner
(PrivilegedExceptionAction<T> action) throws PrivilegedActionException { (PrivilegedExceptionAction<T> action) throws PrivilegedActionException {
DomainCombiner dc = null;
AccessControlContext acc = getStackAccessControlContext(); AccessControlContext acc = getStackAccessControlContext();
if (acc == null || (dc = acc.getAssignedCombiner()) == null) { if (acc == null) {
return AccessController.doPrivileged(action, acc); return AccessController.doPrivileged(action);
} }
DomainCombiner dc = acc.getAssignedCombiner();
return AccessController.doPrivileged(action, preserveCombiner(dc)); return AccessController.doPrivileged(action, preserveCombiner(dc));
} }
...@@ -417,7 +417,12 @@ public final class AccessController { ...@@ -417,7 +417,12 @@ public final class AccessController {
// perform 'combine' on the caller of doPrivileged, // perform 'combine' on the caller of doPrivileged,
// even if the caller is from the bootclasspath // even if the caller is from the bootclasspath
ProtectionDomain[] pds = new ProtectionDomain[] {callerPd}; ProtectionDomain[] pds = new ProtectionDomain[] {callerPd};
return new AccessControlContext(combiner.combine(pds, null), combiner); if (combiner == null) {
return new AccessControlContext(pds);
} else {
return new AccessControlContext(combiner.combine(pds, null),
combiner);
}
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册