[java-shib-shared] branch main updated: Clean up some null warnings

Rod Widdowson rdw at steadingsoftware.com
Wed Jan 25 09:03: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-shared.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=871367e64cb0a97f22e30a27b9209d58b386dc09

The following commit(s) were added to refs/heads/main by this push:
     new 871367e6 Clean up some null warnings
871367e6 is described below

commit 871367e64cb0a97f22e30a27b9209d58b386dc09
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Jan 25 09:03:17 2023 +0000

    Clean up some null warnings
---
 .../java/net/shibboleth/shared/primitive/StringSupport.java  | 12 +++++++-----
 .../java/net/shibboleth/shared/primitive/TimerSupport.java   |  9 ++++++---
 .../java/net/shibboleth/shared/resolver/ResolverSupport.java |  5 +++--
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
index be8fa1c9..175db122 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/StringSupport.java
@@ -28,7 +28,6 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.StringTokenizer;
-import java.util.stream.Collectors;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -70,7 +69,9 @@ public final class StringSupport {
                 stringBuffer.append(line).append("\n");
                 line = reader.readLine();
             }
-            return stringBuffer.toString();
+            final String result = stringBuffer.toString();
+            assert result != null;
+            return result;
         }
     }
 
@@ -94,8 +95,9 @@ public final class StringSupport {
                 stringValue.append(delimiter);
             }
         }
-
-        return stringValue.toString();
+        final String result = stringValue.toString();
+        assert result != null;
+        return result;
     }
 
     /**
@@ -176,7 +178,7 @@ public final class StringSupport {
             return CollectionSupport.emptyList();
         }
         
-        return values.stream().map(StringSupport::trimOrNull).filter(e->e != null).collect(Collectors.toList());
+        return values.stream().map(StringSupport::trimOrNull).filter(e->e != null).collect(CollectionSupport.toList());
     }
 
     /** Null/empty preserving conversion from xs:boolean to {@link Boolean}.
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/TimerSupport.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/TimerSupport.java
index 259d30e9..fd4cb0f5 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/TimerSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/TimerSupport.java
@@ -105,10 +105,13 @@ public final class TimerSupport {
     @Nonnull @NotEmpty private static String uncheckedGetTimerName(@Nonnull final String baseName,
             @Nullable final String additionalData) {
         
+        final String result;
         if (additionalData != null) {
-            return String.format("Timer for %s (%s)", baseName, additionalData);
+            result = String.format("Timer for %s (%s)", baseName, additionalData);
+        } else {
+            result = String.format("Timer for %s", baseName);
         }
-        
-        return String.format("Timer for %s", baseName);
+        assert result != null;
+        return result;
     }
 }
diff --git a/shib-support/src/main/java/net/shibboleth/shared/resolver/ResolverSupport.java b/shib-support/src/main/java/net/shibboleth/shared/resolver/ResolverSupport.java
index a161e703..7df8296c 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/resolver/ResolverSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/resolver/ResolverSupport.java
@@ -112,8 +112,9 @@ public final class ResolverSupport {
         } else {
             predicate = PredicateSupport.and(predicates);
         }
-        
-        return Iterables.filter(candidates, predicate::test);
+        final Iterable<T> result = Iterables.filter(candidates, predicate::test);
+        assert result != null;
+        return result;
     }
     
 }
\ No newline at end of file

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


More information about the commits mailing list