[java-shib-attribute] 10/11: JSATTR-42 - HttpConnectorParser element count checks are cascaded

Scott Cantor cantor.2 at osu.edu
Mon Mar 17 13:58:55 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-shib-attribute.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-attribute.git;a=commit;h=95411c8586f13721a8845c51d1d26aeaba9633d4

commit 95411c8586f13721a8845c51d1d26aeaba9633d4
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jan 21 09:46:29 2025 -0500

    JSATTR-42 - HttpConnectorParser element count checks are cascaded
    
    https://shibboleth.atlassian.net/browse/JSATTR-42
---
 .../dc/http/impl/HTTPDataConnectorParser.java       | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/shib-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/impl/HTTPDataConnectorParser.java b/shib-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/impl/HTTPDataConnectorParser.java
index dd73f2b31..867e7279b 100644
--- a/shib-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/impl/HTTPDataConnectorParser.java
+++ b/shib-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/impl/HTTPDataConnectorParser.java
@@ -149,8 +149,9 @@ public class HTTPDataConnectorParser extends AbstractDataConnectorParser {
      * @param parserContext context
      * @return the bean definition with the parameters.
      */
-    @Nonnull protected static BeanDefinition buildHttpClientSecurityParameters(@Nullable final BeanDefinition inlineParams,
-            @Nullable final String parametersRef, @Nonnull final ParserContext parserContext) {
+    @Nonnull protected static BeanDefinition buildHttpClientSecurityParameters(
+            @Nullable final BeanDefinition inlineParams, @Nullable final String parametersRef,
+            @Nonnull final ParserContext parserContext) {
         
         final BeanDefinitionBuilder factoryBuilder =
                 BeanDefinitionBuilder.genericBeanDefinition(HttpClientSecurityParametersMergingFactoryBean.class);
@@ -275,8 +276,7 @@ public class HTTPDataConnectorParser extends AbstractDataConnectorParser {
             return templateBuilder.getBeanDefinition();
         }
 
-// Checkstyle: CyclomaticComplexity OFF
-// Checkstyle: MethodLength OFF
+// Checkstyle: CyclomaticComplexity|MethodLength OFF
         /**
          * Create the definition of the POST search builder.
          * 
@@ -316,10 +316,14 @@ public class HTTPDataConnectorParser extends AbstractDataConnectorParser {
             if (urlTemplates.size() > 1) {
                 log.warn("{} A maximum of 1 <URLTemplate> should be specified; the first one has been used",
                         getLogPrefix());
-            } else if (bodyTemplates.size() > 1) {
+            }
+            
+            if (bodyTemplates.size() > 1) {
                 log.warn("{} A maximum of 1 <BodyTemplate> should be specified; the first one has been used",
                         getLogPrefix());
-            } else if (cacheKeyTemplates.size() > 1) {
+            }
+            
+            if (cacheKeyTemplates.size() > 1) {
                 log.warn("{} A maximum of 1 <CacheKeyTemplate> should be specified; the first one has been used",
                         getLogPrefix());
             }
@@ -347,7 +351,7 @@ public class HTTPDataConnectorParser extends AbstractDataConnectorParser {
             if (bodyTemplate.hasAttributeNS(null, "charset")) {
                 templateBuilder.addPropertyValue("characterSet", bodyTemplate.getAttributeNS(null, "charset"));
             }
-            if (cacheKeyTemplates.size() > 0) {
+            if (!cacheKeyTemplates.isEmpty()) {
                 templateBuilder.addPropertyValue("cacheKeyTemplateText", cacheKeyTemplates.get(0).getTextContent());
             }
             final String headerMapRef = StringSupport.trimOrNull(configElement.getAttributeNS(null, "headerMapRef"));
@@ -357,8 +361,7 @@ public class HTTPDataConnectorParser extends AbstractDataConnectorParser {
 
             return templateBuilder.getBeanDefinition();
         }
-// Checkstyle: CyclomaticComplexity OFF
-// Checkstyle: MethodLength ON
+// Checkstyle: CyclomaticComplexity|MethodLength ON
         
         /**
          * Get the bean ID of an externally defined mapping strategy.

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


More information about the commits mailing list