[java-shib-attribute] branch main updated: IDP-2080 Review all calls to getServiceableComponent for proper closing
Rod Widdowson
rdw at steadingsoftware.com
Sat Mar 11 16:30:26 UTC 2023
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-shib-attribute.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-attribute.git;a=commit;h=65654960934cf7b75caa51cf07a5b39ad7f254cf
The following commit(s) were added to refs/heads/main by this push:
new 656549609 IDP-2080 Review all calls to getServiceableComponent for proper closing
656549609 is described below
commit 65654960934cf7b75caa51cf07a5b39ad7f254cf
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Mar 11 16:30:03 2023 +0000
IDP-2080 Review all calls to getServiceableComponent for proper closing
https://shibboleth.atlassian.net/browse/IDP-2080
Fix up a couple of cases (in supressed tests)
---
.../attribute/filter/spring/AttributeFilterFailFastTest.java | 11 +++++++----
.../spring/failfast/AttributeResolverFailFastTest.java | 7 ++++---
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/shib-attribute-filter-spring/src/test/java/net/shibboleth/idp/attribute/filter/spring/AttributeFilterFailFastTest.java b/shib-attribute-filter-spring/src/test/java/net/shibboleth/idp/attribute/filter/spring/AttributeFilterFailFastTest.java
index 6e733b367..68f5c065e 100644
--- a/shib-attribute-filter-spring/src/test/java/net/shibboleth/idp/attribute/filter/spring/AttributeFilterFailFastTest.java
+++ b/shib-attribute-filter-spring/src/test/java/net/shibboleth/idp/attribute/filter/spring/AttributeFilterFailFastTest.java
@@ -30,6 +30,7 @@ import net.shibboleth.idp.attribute.filter.AttributeFilter;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.service.ReloadableService;
import net.shibboleth.shared.service.ServiceException;
+import net.shibboleth.shared.service.ServiceableComponent;
import net.shibboleth.spring.testing.AbstractFailFastTest;
/**
@@ -46,11 +47,13 @@ public class AttributeFilterFailFastTest extends AbstractFailFastTest {
@Test public void workingFilter() throws IOException {
final Object bean = getBean(propertySource("ServiceConfiguration", makePath("attributeFilterGood.xml")), "filterBeansDefaultFF.xml");
- final ReloadableService<AttributeFilter > service = (ReloadableService<AttributeFilter>) bean;
+ final ReloadableService<AttributeFilter> service = (ReloadableService<AttributeFilter>) bean;
assertNotNull(service);
- final AttributeFilter filter =
- Constraint.isNotNull(service.getServiceableComponent(), "Component was null").getComponent();
- assertNotNull(filter);
+ try (ServiceableComponent<AttributeFilter> servicableComponent = service.getServiceableComponent()) {
+ assert servicableComponent!=null;
+ final AttributeFilter filter = servicableComponent.getComponent();
+ assertNotNull(filter);
+ }
}
private void badFilter(final Boolean failFast, String filterFile) throws IOException {
diff --git a/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/failfast/AttributeResolverFailFastTest.java b/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/failfast/AttributeResolverFailFastTest.java
index bf87e71cc..741f1a2e4 100644
--- a/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/failfast/AttributeResolverFailFastTest.java
+++ b/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/failfast/AttributeResolverFailFastTest.java
@@ -91,9 +91,10 @@ public class AttributeResolverFailFastTest extends AbstractFailFastTest {
final Object bean = getBean(props, "attributeResolverBeansDefaultFF.xml");
final ReloadableService<AttributeResolver > service = (ReloadableService<AttributeResolver>) bean;
assertNotNull(service);
- final ServiceableComponent<AttributeResolver> component = service.getServiceableComponent();
- final AttributeResolver resolver = component.getComponent();
- assertNotNull(resolver);
+ try (final ServiceableComponent<AttributeResolver> component = service.getServiceableComponent()) {
+ final AttributeResolver resolver = component.getComponent();
+ assertNotNull(resolver);
+ }
}
public void workingAttributeResolver(String file) throws IOException {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list