From 5b2181edb624d4270a3accdc09234a85b41ef2b4 Mon Sep 17 00:00:00 2001 From: JinhangZhang Date: Tue, 28 Jan 2025 22:51:17 -0500 Subject: [PATCH] update the code; will squash after testing --- .../classes/java/security/AccessControlContext.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/jcl/src/java.base/share/classes/java/security/AccessControlContext.java b/jcl/src/java.base/share/classes/java/security/AccessControlContext.java index 813971c7bd0..bbf75f625cd 100644 --- a/jcl/src/java.base/share/classes/java/security/AccessControlContext.java +++ b/jcl/src/java.base/share/classes/java/security/AccessControlContext.java @@ -327,7 +327,6 @@ public AccessControlContext(ProtectionDomain[] fromContext) { AccessControlContext(ProtectionDomain[] context, AccessControlContext parentAcc, AccessControlContext acc, int authorizeState) { super(); - boolean contextChanged = false; switch (authorizeState) { default: // authorizeState can't be STATE_UNKNOWN, callerPD is always NULL @@ -337,6 +336,7 @@ public AccessControlContext(ProtectionDomain[] fromContext) { if (parentAcc == null) { // inherit the domain combiner when authorized this.domainCombiner = acc.domainCombiner; + this.context = context; } else { // when parent combiner is not null, use parent combiner to combine the current context DomainCombiner parentCombiner = parentAcc.getCombiner(); @@ -347,24 +347,20 @@ public AccessControlContext(ProtectionDomain[] fromContext) { this.context = combinePDObjs(context, acc.context); this.domainCombiner = acc.domainCombiner; } - contextChanged = true; } } else { if (parentAcc != null) { this.domainCombiner = parentAcc.domainCombiner; this.nextStackAcc = parentAcc; } + this.context = context; } break; case STATE_NOT_AUTHORIZED: - break; - } - if (!contextChanged) { this.context = context; + break; } - if (acc != null) { - this.doPrivilegedAcc = acc; - } + this.doPrivilegedAcc = acc; this.authorizeState = authorizeState; this.containPrivilegedContext = true; }