[java-identity-provider] branch main updated: IDP-2080 Review all calls to getServiceableComponent for proper closing

Rod Widdowson rdw at steadingsoftware.com
Sat Mar 11 16:32:09 UTC 2023


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=f4e9fbb1fcb6676a68f14666965ca13f8aaaf618

The following commit(s) were added to refs/heads/main by this push:
     new f4e9fbb1f IDP-2080 Review all calls to getServiceableComponent for proper closing
f4e9fbb1f is described below

commit f4e9fbb1fcb6676a68f14666965ca13f8aaaf618
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Mar 11 16:31:58 2023 +0000

    IDP-2080 Review all calls to getServiceableComponent for proper closing
    
    https://shibboleth.atlassian.net/browse/IDP-2080
---
 .../impl/SelectRelyingPartyConfiguration.java       | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/messaging/impl/SelectRelyingPartyConfiguration.java b/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/messaging/impl/SelectRelyingPartyConfiguration.java
index ac307f2d0..209f8c44d 100644
--- a/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/messaging/impl/SelectRelyingPartyConfiguration.java
+++ b/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/messaging/impl/SelectRelyingPartyConfiguration.java
@@ -43,6 +43,7 @@ import net.shibboleth.shared.resolver.CriteriaSet;
 import net.shibboleth.shared.resolver.ResolverException;
 import net.shibboleth.shared.service.ReloadableService;
 import net.shibboleth.shared.service.ServiceException;
+import net.shibboleth.shared.service.ServiceableComponent;
 
 /**
  * This message handler attempts to resolve a {@link RelyingPartyConfiguration} and adds it to the 
@@ -131,16 +132,16 @@ public final class SelectRelyingPartyConfiguration extends AbstractMessageHandle
     @Override
     public void doInvoke(@Nonnull final MessageContext messageContext) throws MessageHandlerException {
 
-        try {
-            final RelyingPartyContext ctx = relyingPartyCtx;
-            assert ctx!=null;
-            // Implicitly "verified", so we include the criterion for that.
-            final String rpId =  ctx.getRelyingPartyId();
-            assert rpId != null;
-            final CriteriaSet criteria = new CriteriaSet(new EntityIdCriterion(rpId),
-                    new VerifiedProfileCriterion(true));
-            final RelyingPartyConfiguration config =
-                    rpConfigResolver.getServiceableComponent().getComponent().resolveSingle(criteria);
+        final RelyingPartyContext ctx = relyingPartyCtx;
+        assert ctx!=null;
+        // Implicitly "verified", so we include the criterion for that.
+        final String rpId =  ctx.getRelyingPartyId();
+        assert rpId != null;
+        final CriteriaSet criteria = new CriteriaSet(new EntityIdCriterion(rpId),
+                new VerifiedProfileCriterion(true));
+
+        try (final ServiceableComponent<RelyingPartyConfigurationResolver> resolver = rpConfigResolver.getServiceableComponent()) {
+            final RelyingPartyConfiguration config = resolver.getComponent().resolveSingle(criteria);
             if (config == null) {
                 log.debug("{} No relying party configuration applies to this request", getLogPrefix());
                 throw new MessageHandlerException("No relying party configuration resolved for this request");

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list