[java-identity-provider] branch maint-5.1 updated: Shore up context cleanup with finally clause.
Scott Cantor
cantor.2 at osu.edu
Tue Aug 19 14:00:15 UTC 2025
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch maint-5.1
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=0f4028c4719f735cdf7910f8a21b02b94d70ff6f
The following commit(s) were added to refs/heads/maint-5.1 by this push:
new 0f4028c47 Shore up context cleanup with finally clause.
0f4028c47 is described below
commit 0f4028c4719f735cdf7910f8a21b02b94d70ff6f
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jun 18 09:02:45 2025 -0400
Shore up context cleanup with finally clause.
---
.../impl/AttributeRevocationCondition.java | 57 +++++++++++++---------
1 file changed, 33 insertions(+), 24 deletions(-)
diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/AttributeRevocationCondition.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/AttributeRevocationCondition.java
index 32df3ce0f..8d09d80a3 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/AttributeRevocationCondition.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/AttributeRevocationCondition.java
@@ -149,6 +149,7 @@ public class AttributeRevocationCondition extends AbstractInitializableComponent
}
}
+// Checkstyle: CyclomaticComplexity OFF
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
public boolean test(@Nullable final ProfileRequestContext input, @Nullable final AuthenticationResult input2) {
@@ -171,39 +172,47 @@ public class AttributeRevocationCondition extends AbstractInitializableComponent
final ScratchContext context = input.ensureSubcontext(ScratchContext.class);
if (!context.getMap().containsKey(getClass())) {
- final AttributeResolutionContext resolutionContext = buildResolutionContext(input, principal);
- assert attributeResolver != null;
- resolutionContext.resolveAttributes(attributeResolver);
-
- final Collection<Instant> records = new ArrayList<>();
- if (resolutionContext.getResolvedIdPAttributes().containsKey(attributeId)) {
- for (final IdPAttributeValue value :
- resolutionContext.getResolvedIdPAttributes().get(attributeId).getValues()) {
- if (value instanceof DateTimeAttributeValue) {
- records.add(((DateTimeAttributeValue) value).getValue());
- } else if (value instanceof StringAttributeValue) {
- try {
- records.add(Instant.ofEpochSecond(Long.valueOf(((StringAttributeValue) value).getValue())));
+ AttributeResolutionContext resolutionContext = null;
+ try {
+ resolutionContext = buildResolutionContext(input, principal);
+ assert attributeResolver != null;
+ resolutionContext.resolveAttributes(attributeResolver);
+
+ final Collection<Instant> records = new ArrayList<>();
+ if (resolutionContext.getResolvedIdPAttributes().containsKey(attributeId)) {
+ for (final IdPAttributeValue value :
+ resolutionContext.getResolvedIdPAttributes().get(attributeId).getValues()) {
+ if (value instanceof DateTimeAttributeValue dtvalue) {
+ records.add(dtvalue.getValue());
+ } else if (value instanceof StringAttributeValue svalue) {
+ try {
+ records.add(Instant.ofEpochSecond(Long.valueOf(svalue.getValue())));
+
+ } catch (final NumberFormatException|DateTimeException e) {
+ log.error("Error parsing timestamp '{}' into epoch",
+ ((StringAttributeValue) value).getValue(), e);
+ }
- } catch (final NumberFormatException|DateTimeException e) {
- log.error("Error parsing timestamp '{}' into epoch",
- ((StringAttributeValue) value).getValue(), e);
+ } else {
+ log.warn("Ignoring non-string attribute value type: {}", value.getClass().getName());
}
-
- } else {
- log.warn("Ignoring non-string attribute value type: {}", value.getClass().getName());
}
+ } else {
+ log.debug("Resolver did not return an IdPAttribute named {} for principal {}",
+ attributeId, principal);
+ }
+
+ context.getMap().put(getClass(), records);
+ } finally {
+ if (resolutionContext != null) {
+ resolutionContext.removeFromParent();
}
- } else {
- log.debug("Resolver did not return an IdPAttribute named {} for principal {}", attributeId, principal);
}
-
- context.getMap().put(getClass(), records);
- resolutionContext.removeFromParent();
}
return isRevoked(principal, input2, (Collection<Instant>) context.getMap().get(getClass()));
}
+// Checkstyle: CyclomaticComplexity ON
/**
* Build an {@link AttributeResolutionContext} to use.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list