[java-shib-metadata] branch main updated: Null handling: use the new null-safe version of Arrays.toList()

Rod Widdowson rdw at steadingsoftware.com
Wed Mar 8 15:06:15 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-metadata.

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

The following commit(s) were added to refs/heads/main by this push:
     new 076a0f22 Null handling: use the new null-safe version of Arrays.toList()
076a0f22 is described below

commit 076a0f22ff1f96cd419078a83c5137ce098207f6
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Mar 8 15:04:20 2023 +0000

    Null handling: use the new null-safe version of Arrays.toList()
    
    Also do some drive by clean up.
---
 .../spring/metadata/AbstractMetadataParserTest.java           |  9 ++++-----
 .../net/shibboleth/spring/testing/AbstractFailFastTest.java   | 11 ++++++++---
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/shib-metadata-spring/src/test/java/net/shibboleth/spring/metadata/AbstractMetadataParserTest.java b/shib-metadata-spring/src/test/java/net/shibboleth/spring/metadata/AbstractMetadataParserTest.java
index 57f40e59..11228a64 100644
--- a/shib-metadata-spring/src/test/java/net/shibboleth/spring/metadata/AbstractMetadataParserTest.java
+++ b/shib-metadata-spring/src/test/java/net/shibboleth/spring/metadata/AbstractMetadataParserTest.java
@@ -22,8 +22,6 @@ import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
@@ -41,6 +39,7 @@ import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeSuite;
 
 import net.shibboleth.idp.saml.metadata.impl.MetadataProviderContainer;
+import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.resolver.CriteriaSet;
 import net.shibboleth.shared.spring.util.ApplicationContextBuilder;
 import net.shibboleth.shared.spring.util.SpringSupport;
@@ -127,12 +126,12 @@ public class AbstractMetadataParserTest extends OpenSAMLInitBaseTestCase {
         mockEnvVars.setProperty("TMPDIR", tempDirName);
 
         if (propSource != null) {
-            builder.setPropertySources(Arrays.asList(propSource, mockEnvVars));
+            builder.setPropertySources(CollectionSupport.arrayAsList(propSource, mockEnvVars));
         } else {
-            builder.setPropertySources(Collections.singletonList(mockEnvVars));
+            builder.setPropertySources(CollectionSupport.singletonList(mockEnvVars));
         }
         
-        builder.setServiceConfigurations(Arrays.asList(resources));
+        builder.setServiceConfigurations(CollectionSupport.arrayAsList(resources));
 
         final GenericApplicationContext context = builder.build();
         
diff --git a/shib-metadata-testing/src/main/java/net/shibboleth/spring/testing/AbstractFailFastTest.java b/shib-metadata-testing/src/main/java/net/shibboleth/spring/testing/AbstractFailFastTest.java
index f0f9ad92..060adb33 100644
--- a/shib-metadata-testing/src/main/java/net/shibboleth/spring/testing/AbstractFailFastTest.java
+++ b/shib-metadata-testing/src/main/java/net/shibboleth/spring/testing/AbstractFailFastTest.java
@@ -19,7 +19,6 @@ package net.shibboleth.spring.testing;
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
@@ -126,9 +125,13 @@ public class AbstractFailFastTest extends OpenSAMLInitBaseTestCase {
         
         builder.setName(contextName);
         
-        builder.setPropertySources(CollectionSupport.singletonList(propSource));
+        if (propSource==null) {
+            builder.setPropertySources(CollectionSupport.emptyList());
+        } else {
+            builder.setPropertySources(CollectionSupport.singletonList(propSource));
+        }
         
-        builder.setServiceConfigurations(Arrays.asList(resources));
+        builder.setServiceConfigurations(CollectionSupport.arrayAsList(resources));
 
         final GenericApplicationContext context = builder.build();
         
@@ -243,6 +246,7 @@ public class AbstractFailFastTest extends OpenSAMLInitBaseTestCase {
          * @return name
          */
         @Nonnull public String name() {
+            assert name!=null;
             return name;
         }
 
@@ -252,6 +256,7 @@ public class AbstractFailFastTest extends OpenSAMLInitBaseTestCase {
          * @return value
          */
         @Nonnull public String value() {
+            assert value!=null;
             return value;
         }
     };

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


More information about the commits mailing list