[java-shib-metadata] branch main updated: Guard against null Keyword values and re-enable test.

Scott Cantor cantor.2 at osu.edu
Wed Apr 5 19:40:14 UTC 2023


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

scantor pushed a commit to branch main
in repository java-shib-metadata.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-metadata.git;a=commit;h=2351083c84f18cf7a69cb8f7d26663c94b8ffa7e

The following commit(s) were added to refs/heads/main by this push:
     new 2351083c Guard against null Keyword values and re-enable test.
2351083c is described below

commit 2351083c84f18cf7a69cb8f7d26663c94b8ffa7e
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Apr 5 15:40:11 2023 -0400

    Guard against null Keyword values and re-enable test.
---
 .../java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java  | 15 ++++++++-------
 .../net/shibboleth/idp/saml/metadata/IdPUIInfoTest.java   |  3 ++-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/shib-metadata-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java b/shib-metadata-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java
index 7a8440e8..d49c952b 100644
--- a/shib-metadata-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java
+++ b/shib-metadata-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java
@@ -72,7 +72,7 @@ public class IdPUIInfo {
     private final Predicate<Keywords> nullLanguageKeyword = new Predicate<>() {
         public boolean test(@Nullable final Keywords u) {
             if (u != null && u.getXMLLang() == null) {
-                LOG.warn("Keyword with value {} in <IdpUIInfo/> has no language associated, ignoring", u.getKeywords());
+                LOG.warn("Keyword with value {} in <UIInfo/> has no language associated, ignoring", u.getKeywords());
                 return false;
             }
             return true;
@@ -92,7 +92,7 @@ public class IdPUIInfo {
                 collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableMap(
 				        displayName -> Locale.forLanguageTag(displayName.getXMLLang()),
 				        displayName -> displayName.getValue(),
-				        CollectionSupport.warningMergeFunction("IdpUIInfo DisplayName", false)))).
+				        CollectionSupport.warningMergeFunction("IdPUIInfo DisplayName", false)))).
                 get();
         keywordList = uiInfo.
                 getKeywords().
@@ -100,8 +100,9 @@ public class IdPUIInfo {
                 filter(nullLanguageKeyword).
                 collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableMap(
                         keywords -> Locale.forLanguageTag(keywords.getXMLLang()), 
-                        keywords -> keywords.getKeywords(),
-                        CollectionSupport.warningMergeFunction("IdpUIInfo Keyword", false)))).
+                        keywords -> keywords.getKeywords() != null
+                            ? keywords.getKeywords() : CollectionSupport.<String>emptyList(),
+                        CollectionSupport.warningMergeFunction("IdPUIInfo Keyword", false)))).
                 get();
 
         descriptions = uiInfo.
@@ -111,7 +112,7 @@ public class IdPUIInfo {
                 collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableMap(
                         description -> Locale.forLanguageTag(description.getXMLLang()), 
                         description -> description.getValue(),
-                        CollectionSupport.warningMergeFunction("IdpUIInfo Descriptions", false)))).
+                        CollectionSupport.warningMergeFunction("IdPUIInfo Descriptions", false)))).
                 get();
 
         informationURLs = uiInfo.
@@ -121,7 +122,7 @@ public class IdPUIInfo {
                 collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableMap(
                         url -> Locale.forLanguageTag(url.getXMLLang()), 
                         dn -> dn.getURI(),
-                        CollectionSupport.warningMergeFunction("IdpUIInfo InformationURL", false)))).
+                        CollectionSupport.warningMergeFunction("IdPUIInfo InformationURL", false)))).
                 get();
 
         privacyStatementURLs = uiInfo.
@@ -131,7 +132,7 @@ public class IdPUIInfo {
                 collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableMap(
                         url -> Locale.forLanguageTag(url.getXMLLang()), 
                         url -> url.getURI(),
-                        CollectionSupport.warningMergeFunction("IdpUIInfo PrivacyStatementURL", false)))).
+                        CollectionSupport.warningMergeFunction("IdPUIInfo PrivacyStatementURL", false)))).
                 get();
         
         final List<Logo> noLocaleLogo = new ArrayList<>();
diff --git a/shib-metadata-api/src/test/java/net/shibboleth/idp/saml/metadata/IdPUIInfoTest.java b/shib-metadata-api/src/test/java/net/shibboleth/idp/saml/metadata/IdPUIInfoTest.java
index 1ef96010..9429eeb6 100644
--- a/shib-metadata-api/src/test/java/net/shibboleth/idp/saml/metadata/IdPUIInfoTest.java
+++ b/shib-metadata-api/src/test/java/net/shibboleth/idp/saml/metadata/IdPUIInfoTest.java
@@ -48,7 +48,8 @@ public class IdPUIInfoTest extends XMLObjectBaseTestCase {
         assertEquals(uiInfo.getInformationURLs().size(), 1);
         assertEquals(uiInfo.getPrivacyStatementURLs().size(), 1);
     }
-    @Test(enabled=false) public void testBad() {
+    
+    @Test public void testBad() {
 
         final UIInfo samluiinfo = unmarshallElement("/UIInfoBad.xml");
         assert(samluiinfo != null);

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


More information about the commits mailing list