[java-shib-shared] branch main updated: Another round of null cleanup.
Scott Cantor
cantor.2 at osu.edu
Fri Jan 20 20:29:16 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-shared.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=986e0172a2cd17f4b5155f988d017ad685989148
The following commit(s) were added to refs/heads/main by this push:
new 986e0172 Another round of null cleanup.
986e0172 is described below
commit 986e0172a2cd17f4b5155f988d017ad685989148
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Jan 20 15:29:13 2023 -0500
Another round of null cleanup.
---
.../shibboleth/shared/cli/AbstractCommandLine.java | 5 +-
.../shared/cli/AbstractCommandLineArguments.java | 8 +-
.../resource/FileBackedHTTPResource.java | 5 +-
.../spring/httpclient/resource/HTTPResource.java | 5 +-
.../shared/spring/servlet/ChainableFilter.java | 2 +-
.../spring/servlet/RequestURLPrefixPredicate.java | 9 +-
.../shared/spring/servlet/URLPrefix.java | 2 +-
.../HttpServletRequestResponseContextTest.java | 5 +-
.../impl/RequestResponseContextFilterTest.java | 5 +-
.../impl/SameSiteCookieHeaderFilterTest.java | 1 +
.../httpclient/ContextHandlingHttpClient.java | 3 +-
.../shared/httpclient/HttpClientBuilder.java | 42 +++---
.../shared/httpclient/TLSSocketFactory.java | 2 +-
.../java/net/shibboleth/shared/net/IPRange.java | 4 +-
.../shared/net/SimpleURLCanonicalizer.java | 2 +-
.../java/net/shibboleth/shared/net/URISupport.java | 4 +-
.../shared/servlet/AbstractConditionalFilter.java | 6 +-
.../shared/servlet/HttpServletSupport.java | 4 +-
.../shared/servlet/impl/StubbedFilter.java | 6 +-
.../ThreadLocalHttpServletRequestSupplier.java | 2 +-
.../ThreadLocalHttpServletResponseSupplier.java | 2 +-
.../net/shibboleth/shared/security/DataSealer.java | 4 +-
.../shared/security/DataSealerKeyStrategy.java | 5 +-
.../shared/service/AbstractReloadableService.java | 6 +-
.../service/reloadable/NonReloadableExcluder.java | 8 +-
.../shared/service/reloadable/ReloadableScope.java | 3 +-
.../impl/DelegatingAccessControlService.java | 2 +-
.../service/AbstractServiceableComponent.java | 8 +-
.../service/ApplicationContextServiceStrategy.java | 3 +-
.../spring/service/ClassBasedServiceStrategy.java | 3 +-
.../spring/service/ReloadableSpringService.java | 20 +--
.../service/impl/SpringServiceableComponent.java | 3 +-
.../shared/spring/service/impl/package-info.java | 18 +--
.../spring/service/NonReloadableTestBean.java | 2 +-
.../spring/service/ReloadableBeanServiceTest.java | 4 +-
.../service/ReloadableSpringServiceTest.java | 16 +-
.../shared/spring/service/ReloadableTestBean.java | 14 +-
.../spring/config/DeprecatedBeanDetector.java | 3 +-
.../spring/config/FunctionToFunctionConverter.java | 4 +-
.../config/IdentifiableBeanPostProcessor.java | 3 +-
.../spring/config/IdentifiedComponentManager.java | 11 +-
.../config/PredicateToPredicateConverter.java | 4 +-
.../config/RelocatedBeanFactoryPostProcessor.java | 11 +-
.../config/StringBooleanToPredicateConverter.java | 14 +-
.../spring/config/StringToDurationConverter.java | 4 +-
.../spring/config/StringToIPRangeConverter.java | 4 +-
.../spring/config/StringToPeriodConverter.java | 4 +-
.../spring/config/StringToResourceConverter.java | 5 +-
...actPropertiesApplicationContextInitializer.java | 5 +-
.../custom/AbstractCustomBeanDefinitionParser.java | 4 +-
.../spring/custom/BaseSpringNamespaceHandler.java | 13 +-
.../custom/EmbeddedAndSchemaAwareReader.java | 3 +-
.../custom/LocalOnlyResourceEntityResolver.java | 164 +++++++++++----------
...chemaTypeAwareBeanDefinitionParserDelegate.java | 1 +
.../SchemaTypeAwareXMLBeanDefinitionReader.java | 3 +-
.../spring/custom/SecondaryNamespaceHandler.java | 7 +-
.../spring/error/ErrorRaisingController.java | 3 +-
.../AbstractSpringExpressionEvaluator.java | 3 +-
.../expression/SpringExpressionBiConsumer.java | 3 +-
.../expression/SpringExpressionBiFunction.java | 3 +-
.../expression/SpringExpressionBiPredicate.java | 3 +-
.../expression/SpringExpressionConsumer.java | 6 +-
.../expression/SpringExpressionFunction.java | 6 +-
.../expression/SpringExpressionPredicate.java | 7 +-
.../spring/factory/EvaluableScriptFactoryBean.java | 3 +-
.../spring/resource/ConditionalResource.java | 3 +-
.../resource/ConditionalResourceResolver.java | 2 +-
.../resource/RunnableFileSystemResource.java | 3 +-
.../spring/util/ApplicationContextBuilder.java | 5 +-
.../shared/spring/util/SpringSupport.java | 6 +-
.../shared/scripting/AbstractScriptEvaluator.java | 3 +-
.../shibboleth/shared/xml/AttributeSupport.java | 3 +-
.../net/shibboleth/shared/xml/ElementSupport.java | 14 +-
.../shared/xml/impl/BasicParserPool.java | 11 +-
.../shared/testing/ConstantSupplier.java | 6 +-
.../spring/velocity/SpringResourceLoader.java | 3 +-
.../spring/velocity/VelocityEngineFactory.java | 4 +-
.../shared/spring/velocity/VelocityView.java | 14 +-
.../net/shibboleth/shared/velocity/Template.java | 1 +
79 files changed, 344 insertions(+), 281 deletions(-)
diff --git a/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLine.java b/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLine.java
index c851f6b9..0103904b 100644
--- a/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLine.java
+++ b/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLine.java
@@ -20,7 +20,6 @@ package net.shibboleth.shared.cli;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -41,6 +40,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.spring.context.FilesystemGenericApplicationContext;
import net.shibboleth.shared.spring.resource.PreferFileSystemResourceLoader;
@@ -164,7 +164,7 @@ public abstract class AbstractCommandLine<T extends CommandLineArguments> {
* @return the resources
*/
@Nonnull @NonnullElements @Unmodifiable @NotLive protected List<Resource> getAdditionalSpringResources() {
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
/**
@@ -271,6 +271,7 @@ public abstract class AbstractCommandLine<T extends CommandLineArguments> {
final List<PropertySource<?>> propertySources = new ArrayList<>(resources.size());
resources.forEach(r -> {
try {
+ assert r != null;
propertySources.add(new ResourcePropertySource(r));
} catch (final IOException e) {
if (args.isVerboseOutput()) {
diff --git a/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLineArguments.java b/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLineArguments.java
index 84e92e50..fff1a0e3 100644
--- a/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLineArguments.java
+++ b/shib-cli/src/main/java/net/shibboleth/shared/cli/AbstractCommandLineArguments.java
@@ -19,7 +19,6 @@ package net.shibboleth.shared.cli;
import java.io.PrintStream;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Locale.LanguageRange;
@@ -34,6 +33,7 @@ import com.google.common.base.Strings;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
/** Command line arguments base class for the {@link AbstractCommandLine} class. */
public abstract class AbstractCommandLineArguments implements CommandLineArguments {
@@ -136,9 +136,9 @@ public abstract class AbstractCommandLineArguments implements CommandLineArgumen
*/
@Nonnull @NonnullElements @Unmodifiable @NotLive public List<LanguageRange> getLanguageRanges() {
if (Strings.isNullOrEmpty(languageRanges)) {
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
- return List.copyOf(LanguageRange.parse(languageRanges));
+ return CollectionSupport.copyToList(LanguageRange.parse(languageRanges));
}
/** {@inheritDoc} */
@@ -154,7 +154,7 @@ public abstract class AbstractCommandLineArguments implements CommandLineArgumen
}
/** {@inheritDoc} */
- public void printHelp(final PrintStream out) {
+ public void printHelp(@Nonnull final PrintStream out) {
out.println();
out.println("==== Command Line Options ====");
out.println();
diff --git a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPResource.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPResource.java
index ca9b798e..4f50c2c5 100644
--- a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPResource.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/FileBackedHTTPResource.java
@@ -29,12 +29,13 @@ import javax.annotation.Nonnull;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
@@ -97,7 +98,7 @@ public class FileBackedHTTPResource extends HTTPResource {
* @throws IOException if an error happens. If the backing file might have been corrupted we delete it.
*/
- protected InputStream saveAndClone(final InputStream input) throws IOException {
+ @Nonnull protected InputStream saveAndClone(final InputStream input) throws IOException {
try (final FileOutputStream out = new FileOutputStream(backingResource.getFile())) {
log.debug("{}: Copying file.", getDescription());
ByteStreams.copy(input, out);
diff --git a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/HTTPResource.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/HTTPResource.java
index d20eff37..98890fe9 100644
--- a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/HTTPResource.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/httpclient/resource/HTTPResource.java
@@ -42,7 +42,7 @@ import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.client.utils.DateUtils;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
@@ -53,6 +53,7 @@ import net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.httpclient.HttpClientContextHandler;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
/**
@@ -197,7 +198,7 @@ public class HTTPResource extends AbstractIdentifiedInitializableComponent imple
}
/** {@inheritDoc} */
- @Override public void setBeanName(final String name) {
+ @Override public void setBeanName(@Nonnull final String name) {
setId(name);
}
diff --git a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/ChainableFilter.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/ChainableFilter.java
index 2e403375..37a213d7 100644
--- a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/ChainableFilter.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/ChainableFilter.java
@@ -54,7 +54,7 @@ public interface ChainableFilter extends Filter, Ordered {
*
* @param value value to use
*/
- private FilterOrder(int value) {
+ private FilterOrder(final int value) {
intValue = value;
}
diff --git a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/RequestURLPrefixPredicate.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/RequestURLPrefixPredicate.java
index 81dc0752..e6293d3e 100644
--- a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/RequestURLPrefixPredicate.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/RequestURLPrefixPredicate.java
@@ -18,8 +18,6 @@
package net.shibboleth.shared.spring.servlet;
import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
import java.util.function.Predicate;
import javax.annotation.Nonnull;
@@ -31,6 +29,7 @@ import jakarta.servlet.ServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
+import net.shibboleth.shared.collection.CollectionSupport;
/**
* Predicate based on comparing a request URL to a set of matching prefixes.
@@ -38,7 +37,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullElements;
public class RequestURLPrefixPredicate implements Predicate<ServletRequest> {
/** Prefixes to check for. */
- @Nonnull @NonnullElements public Collection<URLPrefix> matchingPrefixes;
+ @Nonnull @NonnullElements private Collection<URLPrefix> matchingPrefixes;
/**
* Constructor.
@@ -49,9 +48,9 @@ public class RequestURLPrefixPredicate implements Predicate<ServletRequest> {
public RequestURLPrefixPredicate(
@Nullable @NonnullElements @ParameterName(name="prefixes") final Collection<URLPrefix> prefixes) {
if (prefixes != null) {
- matchingPrefixes = List.copyOf(prefixes);
+ matchingPrefixes = CollectionSupport.copyToList(prefixes);
} else {
- matchingPrefixes = Collections.emptyList();
+ matchingPrefixes = CollectionSupport.emptyList();
}
}
diff --git a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/URLPrefix.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/URLPrefix.java
index d3b43e6c..9d835d69 100644
--- a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/URLPrefix.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/URLPrefix.java
@@ -28,7 +28,7 @@ import net.shibboleth.shared.primitive.StringSupport;
public class URLPrefix {
/** The wrapped string. */
- @Nonnull @NotEmpty final String wrappedString;
+ @Nonnull @NotEmpty private final String wrappedString;
/**
* Constructor.
diff --git a/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/HttpServletRequestResponseContextTest.java b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/HttpServletRequestResponseContextTest.java
index 9105d5c3..4285a67a 100644
--- a/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/HttpServletRequestResponseContextTest.java
+++ b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/HttpServletRequestResponseContextTest.java
@@ -31,6 +31,7 @@ import net.shibboleth.shared.servlet.impl.HttpServletRequestResponseContext;
/**
* Tests for {@link HttpServletRequestResponseContext}.
*/
+ at SuppressWarnings("javadoc")
public class HttpServletRequestResponseContextTest {
private HttpServletRequest request;
@@ -38,14 +39,14 @@ public class HttpServletRequestResponseContextTest {
@BeforeMethod
public void setUp() {
- MockHttpServletRequest mockRequest = new MockHttpServletRequest();
+ final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
mockRequest.setMethod("GET");
mockRequest.setRequestURI("/foo");
mockRequest.addHeader("MyRequestHeader", "MyRequestHeaderValue");
mockRequest.addParameter("MyParam", "MyParamValue");
request = mockRequest;
- MockHttpServletResponse mockResponse = new MockHttpServletResponse();
+ final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
mockResponse.setHeader("MyResponseHeader", "MyResponseHeaderValue");
response = mockResponse;
}
diff --git a/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/RequestResponseContextFilterTest.java b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/RequestResponseContextFilterTest.java
index feb42185..b5d8575d 100644
--- a/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/RequestResponseContextFilterTest.java
+++ b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/RequestResponseContextFilterTest.java
@@ -42,6 +42,7 @@ import net.shibboleth.shared.servlet.impl.HttpServletRequestResponseContext;
/**
* Tests for {@link RequestResponseContextFilter}.
*/
+ at SuppressWarnings("javadoc")
public class RequestResponseContextFilterTest {
private HttpServletRequest request;
@@ -54,14 +55,14 @@ public class RequestResponseContextFilterTest {
@BeforeMethod
public void setUp() throws ServletException {
- MockHttpServletRequest mockRequest = new MockHttpServletRequest();
+ final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
mockRequest.setMethod("GET");
mockRequest.setRequestURI("/foo");
mockRequest.addHeader("MyRequestHeader", "MyRequestHeaderValue");
mockRequest.addParameter("MyParam", "MyParamValue");
request = mockRequest;
- MockHttpServletResponse mockResponse = new MockHttpServletResponse();
+ final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
mockResponse.setHeader("MyResponseHeader", "MyResponseHeaderValue");
response = mockResponse;
diff --git a/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/SameSiteCookieHeaderFilterTest.java b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/SameSiteCookieHeaderFilterTest.java
index 4741fb39..e4cc32a5 100644
--- a/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/SameSiteCookieHeaderFilterTest.java
+++ b/shib-networking-spring/src/test/java/net/shibboleth/shared/spring/servlet/impl/SameSiteCookieHeaderFilterTest.java
@@ -57,6 +57,7 @@ import net.shibboleth.shared.spring.servlet.impl.SameSiteCookieHeaderFilter.Same
/**
* Tests for {@link SameSiteCookieHeaderFilter}.
*/
+ at SuppressWarnings("javadoc")
public class SameSiteCookieHeaderFilterTest {
private MockHttpServletRequest request;
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/httpclient/ContextHandlingHttpClient.java b/shib-networking/src/main/java/net/shibboleth/shared/httpclient/ContextHandlingHttpClient.java
index d701f077..47fb4d66 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/httpclient/ContextHandlingHttpClient.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/httpclient/ContextHandlingHttpClient.java
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.LazyList;
import net.shibboleth.shared.logic.Constraint;
@@ -81,7 +82,7 @@ class ContextHandlingHttpClient extends CloseableHttpClient {
* @param client the wrapped client instance
*/
public ContextHandlingHttpClient(@Nonnull final CloseableHttpClient client) {
- this(client, List.of());
+ this(client, CollectionSupport.emptyList());
}
/**
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/httpclient/HttpClientBuilder.java b/shib-networking/src/main/java/net/shibboleth/shared/httpclient/HttpClientBuilder.java
index 3e152a46..942c7bda 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/httpclient/HttpClientBuilder.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/httpclient/HttpClientBuilder.java
@@ -20,7 +20,6 @@ package net.shibboleth.shared.httpclient;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.Duration;
-import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
@@ -44,6 +43,7 @@ import org.apache.http.util.CharsetUtils;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.StringSupport;
@@ -280,11 +280,11 @@ public class HttpClientBuilder {
httpContentCharSet = "UTF-8";
userAgent = null;
- requestInterceptorsFirst = Collections.emptyList();
- requestInterceptorsLast = Collections.emptyList();
- responseInterceptorsFirst = Collections.emptyList();
- responseInterceptorsLast = Collections.emptyList();
- staticContextHandlers = Collections.emptyList();
+ requestInterceptorsFirst = CollectionSupport.emptyList();
+ requestInterceptorsLast = CollectionSupport.emptyList();
+ responseInterceptorsFirst = CollectionSupport.emptyList();
+ responseInterceptorsLast = CollectionSupport.emptyList();
+ staticContextHandlers = CollectionSupport.emptyList();
}
/** Resets all builder parameters to their defaults. */
@@ -310,11 +310,11 @@ public class HttpClientBuilder {
httpContentCharSet = "UTF-8";
userAgent = null;
- requestInterceptorsFirst = Collections.emptyList();
- requestInterceptorsLast = Collections.emptyList();
- responseInterceptorsFirst = Collections.emptyList();
- responseInterceptorsLast = Collections.emptyList();
- staticContextHandlers = Collections.emptyList();
+ requestInterceptorsFirst = CollectionSupport.emptyList();
+ requestInterceptorsLast = CollectionSupport.emptyList();
+ responseInterceptorsFirst = CollectionSupport.emptyList();
+ responseInterceptorsLast = CollectionSupport.emptyList();
+ staticContextHandlers = CollectionSupport.emptyList();
}
/**
@@ -899,9 +899,9 @@ public class HttpClientBuilder {
public void setFirstRequestInterceptors(
@Nullable @NonnullElements final List<HttpRequestInterceptor> interceptors) {
if (interceptors != null) {
- requestInterceptorsFirst = List.copyOf(interceptors);
+ requestInterceptorsFirst = CollectionSupport.copyToList(interceptors);
} else {
- requestInterceptorsFirst = Collections.emptyList();
+ requestInterceptorsFirst = CollectionSupport.emptyList();
}
}
@@ -922,9 +922,9 @@ public class HttpClientBuilder {
*/
public void setLastRequestInterceptors(@Nullable @NonnullElements final List<HttpRequestInterceptor> interceptors) {
if (interceptors != null) {
- requestInterceptorsLast = List.copyOf(interceptors);
+ requestInterceptorsLast = CollectionSupport.copyToList(interceptors);
} else {
- requestInterceptorsLast = Collections.emptyList();
+ requestInterceptorsLast = CollectionSupport.emptyList();
}
}
@@ -946,9 +946,9 @@ public class HttpClientBuilder {
public void setFirstResponseInterceptors(
@Nullable @NonnullElements final List<HttpResponseInterceptor> interceptors) {
if (interceptors != null) {
- responseInterceptorsFirst = List.copyOf(interceptors);
+ responseInterceptorsFirst = CollectionSupport.copyToList(interceptors);
} else {
- responseInterceptorsFirst = Collections.emptyList();
+ responseInterceptorsFirst = CollectionSupport.emptyList();
}
}
@@ -970,9 +970,9 @@ public class HttpClientBuilder {
public void setLastResponseInterceptors(
@Nullable @NonnullElements final List<HttpResponseInterceptor> interceptors) {
if (interceptors != null) {
- responseInterceptorsLast = List.copyOf(interceptors);
+ responseInterceptorsLast = CollectionSupport.copyToList(interceptors);
} else {
- responseInterceptorsLast = Collections.emptyList();
+ responseInterceptorsLast = CollectionSupport.emptyList();
}
}
@@ -993,9 +993,9 @@ public class HttpClientBuilder {
*/
public void setStaticContextHandlers(@Nullable @NonnullElements final List<HttpClientContextHandler> handlers) {
if (handlers != null) {
- staticContextHandlers = List.copyOf(handlers);
+ staticContextHandlers = CollectionSupport.copyToList(handlers);
} else {
- staticContextHandlers = Collections.emptyList();
+ staticContextHandlers = CollectionSupport.emptyList();
}
}
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/httpclient/TLSSocketFactory.java b/shib-networking/src/main/java/net/shibboleth/shared/httpclient/TLSSocketFactory.java
index c265b3a0..87841e53 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/httpclient/TLSSocketFactory.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/httpclient/TLSSocketFactory.java
@@ -36,6 +36,7 @@ import javax.net.ssl.SSLSocketFactory;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import org.apache.http.HttpHost;
@@ -46,7 +47,6 @@ import org.apache.http.conn.util.PublicSuffixMatcher;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.Args;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/net/IPRange.java b/shib-networking/src/main/java/net/shibboleth/shared/net/IPRange.java
index 9b90e674..b3eb97cc 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/net/IPRange.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/net/IPRange.java
@@ -123,7 +123,7 @@ public class IPRange {
}
for (final String component : components) {
final int value = Integer.parseInt(component, 10);
- if (value < 0 || (value > 255)) {
+ if (value < 0 || value > 255) {
throw new IllegalArgumentException("IPv4 component range error: " + component);
}
}
@@ -144,7 +144,7 @@ public class IPRange {
for (final String component : components) {
if (component.length() != 0) {
final int value = Integer.parseInt(component, 16);
- if (value < 0 || (value > 0xFFFF)) {
+ if (value < 0 || value > 0xFFFF) {
throw new IllegalArgumentException("IPv6 component range error: " + component);
}
}
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/net/SimpleURLCanonicalizer.java b/shib-networking/src/main/java/net/shibboleth/shared/net/SimpleURLCanonicalizer.java
index 1f970b0b..bfa326a4 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/net/SimpleURLCanonicalizer.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/net/SimpleURLCanonicalizer.java
@@ -110,7 +110,7 @@ public final class SimpleURLCanonicalizer {
if (scheme != null) {
scheme = scheme.toLowerCase();
url.setScheme(scheme);
-
+ assert scheme != null;
final Integer port = getRegisteredPort(scheme);
if (port != null && port.equals(url.getPort())) {
url.setPort(null);
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/net/URISupport.java b/shib-networking/src/main/java/net/shibboleth/shared/net/URISupport.java
index f6bf8897..264d94a2 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/net/URISupport.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/net/URISupport.java
@@ -23,7 +23,6 @@ import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -31,6 +30,7 @@ import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.LazyList;
import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.primitive.StringSupport;
@@ -241,7 +241,7 @@ public final class URISupport {
*/
@Nonnull public static Map<String,String> buildQueryMap(@Nullable final List<Pair<String, String>> parameters) {
if (parameters == null || parameters.size() == 0) {
- return Collections.emptyMap();
+ return CollectionSupport.emptyMap();
}
final HashMap<String,String> map = new HashMap<>();
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/servlet/AbstractConditionalFilter.java b/shib-networking/src/main/java/net/shibboleth/shared/servlet/AbstractConditionalFilter.java
index 9c5a5f97..2561ca85 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/servlet/AbstractConditionalFilter.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/servlet/AbstractConditionalFilter.java
@@ -29,8 +29,8 @@ import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.logic.PredicateSupport;
-import com.google.common.base.Predicates;
/**
* Base class for HTTP servlet {@link Filter} that determines whether to run dynamically
@@ -45,7 +45,7 @@ public abstract class AbstractConditionalFilter implements Filter {
/** Constructor. */
public AbstractConditionalFilter() {
- activationCondition = Predicates.alwaysTrue();
+ activationCondition = PredicateSupport.alwaysTrue();
}
/**
@@ -62,7 +62,7 @@ public abstract class AbstractConditionalFilter implements Filter {
*
* @param condition run condition
*/
- public void setActivationCondition(@Nonnull Predicate<ServletRequest> condition) {
+ public void setActivationCondition(@Nonnull final Predicate<ServletRequest> condition) {
activationCondition = Constraint.isNotNull(condition, "Run condition cannot be null");
}
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/servlet/HttpServletSupport.java b/shib-networking/src/main/java/net/shibboleth/shared/servlet/HttpServletSupport.java
index fabe4a71..7c8a940a 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/servlet/HttpServletSupport.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/servlet/HttpServletSupport.java
@@ -18,7 +18,6 @@
package net.shibboleth.shared.servlet;
import java.net.URI;
-import java.util.Collections;
import java.util.List;
import java.util.Locale.LanguageRange;
import java.util.Set;
@@ -36,6 +35,7 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.net.MediaTypeSupport;
import net.shibboleth.shared.primitive.StringSupport;
@@ -166,7 +166,7 @@ public final class HttpServletSupport {
LOG.warn("Could not parse provided languages '{}'", languages, e);
}
}
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
/**
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/StubbedFilter.java b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/StubbedFilter.java
index d58c3f1f..e0c86a67 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/StubbedFilter.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/StubbedFilter.java
@@ -40,7 +40,7 @@ import net.shibboleth.shared.primitive.StringSupport;
public class StubbedFilter implements Filter {
/** Class name to warn about, defaults to the name of this class (or its superclass). */
- @Nonnull @NotEmpty final String className;
+ @Nonnull @NotEmpty private final String className;
/** Constructor. */
public StubbedFilter() {
@@ -62,13 +62,13 @@ public class StubbedFilter implements Filter {
/** {@inheritDoc} */
@Override
- public void init(FilterConfig filterConfig) throws ServletException {
+ public void init(final FilterConfig filterConfig) throws ServletException {
DeprecationSupport.warn(ObjectType.CONFIGURATION, className, "edit-webapp/WEB-INF/web.xml", null);
}
/** {@inheritDoc} */
@Override
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+ public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
DeprecationSupport.warnOnce(ObjectType.CONFIGURATION, className, "edit-webapp/WEB-INF/web.xml", null);
chain.doFilter(request, response);
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ThreadLocalHttpServletRequestSupplier.java b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ThreadLocalHttpServletRequestSupplier.java
index c244b083..895d372c 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ThreadLocalHttpServletRequestSupplier.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ThreadLocalHttpServletRequestSupplier.java
@@ -38,7 +38,7 @@ public class ThreadLocalHttpServletRequestSupplier implements NonnullSupplier<Ht
@Nonnull public HttpServletRequest get() {
final HttpServletRequest req = Constraint.isNotNull(HttpServletRequestResponseContext.getRequest(),
"Current HttpServletRequest has not been loaded via HttpServletRequestResponseContext");
- assert(req != null);
+ assert req != null;
return req;
}
}
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ThreadLocalHttpServletResponseSupplier.java b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ThreadLocalHttpServletResponseSupplier.java
index 2af2d9da..736236cd 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ThreadLocalHttpServletResponseSupplier.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/servlet/impl/ThreadLocalHttpServletResponseSupplier.java
@@ -38,7 +38,7 @@ public class ThreadLocalHttpServletResponseSupplier implements NonnullSupplier<H
@Nonnull public HttpServletResponse get() {
final HttpServletResponse response = Constraint.isNotNull(HttpServletRequestResponseContext.getResponse(),
"Current HttpServletResponse has not been loaded via HttpServletRequestResponseContext");
- assert(response!=null);
+ assert response!=null;
return response;
}
}
diff --git a/shib-security/src/main/java/net/shibboleth/shared/security/DataSealer.java b/shib-security/src/main/java/net/shibboleth/shared/security/DataSealer.java
index 824d4700..f3e06649 100644
--- a/shib-security/src/main/java/net/shibboleth/shared/security/DataSealer.java
+++ b/shib-security/src/main/java/net/shibboleth/shared/security/DataSealer.java
@@ -42,15 +42,14 @@ import org.apache.commons.codec.BinaryEncoder;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.ConstraintViolationException;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.security.DataSealerKeyStrategy.NamedKey;
@@ -268,6 +267,7 @@ public class DataSealer extends AbstractInitializableComponent {
if (keyUsed != null) {
keyUsed.append(keyAlias);
}
+ assert keyAlias != null;
final SecretKey key = keyStrategy.getKey(keyAlias);
final Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
diff --git a/shib-security/src/main/java/net/shibboleth/shared/security/DataSealerKeyStrategy.java b/shib-security/src/main/java/net/shibboleth/shared/security/DataSealerKeyStrategy.java
index 137a443c..d7522d72 100644
--- a/shib-security/src/main/java/net/shibboleth/shared/security/DataSealerKeyStrategy.java
+++ b/shib-security/src/main/java/net/shibboleth/shared/security/DataSealerKeyStrategy.java
@@ -80,9 +80,8 @@ public interface DataSealerKeyStrategy {
*/
record NamedKey(@Nonnull @NotEmpty String name, @Nonnull SecretKey key) {
- /** Constructor.
- * @param name key name
- * @param key key value
+ /**
+ * Constructor.
*/
public NamedKey {
Constraint.isTrue(name != null && name.length() > 0, "Name cannot be empty or null");
diff --git a/shib-service/src/main/java/net/shibboleth/shared/service/AbstractReloadableService.java b/shib-service/src/main/java/net/shibboleth/shared/service/AbstractReloadableService.java
index 33f0bbc8..363609d4 100644
--- a/shib-service/src/main/java/net/shibboleth/shared/service/AbstractReloadableService.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/service/AbstractReloadableService.java
@@ -26,13 +26,13 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.component.UnmodifiableComponent;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.TimerSupport;
/**
@@ -198,7 +198,7 @@ public abstract class AbstractReloadableService<T> extends AbstractIdentifiableI
}
log.info("{} Reload interval set to: {}, starting refresh thread", getLogPrefix(), reloadCheckDelay);
reloadTask = new ServiceReloadTask();
- assert(internalTaskTimer != null);
+ assert internalTaskTimer != null;
internalTaskTimer.schedule(reloadTask, reloadCheckDelay.toMillis(), reloadCheckDelay.toMillis());
}
}
@@ -278,6 +278,8 @@ public abstract class AbstractReloadableService<T> extends AbstractIdentifiableI
prefix = "Service:";
}
}
+
+ assert prefix != null;
return prefix;
}
diff --git a/shib-service/src/main/java/net/shibboleth/shared/service/reloadable/NonReloadableExcluder.java b/shib-service/src/main/java/net/shibboleth/shared/service/reloadable/NonReloadableExcluder.java
index a92707fb..a9b414fc 100644
--- a/shib-service/src/main/java/net/shibboleth/shared/service/reloadable/NonReloadableExcluder.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/service/reloadable/NonReloadableExcluder.java
@@ -20,12 +20,14 @@ package net.shibboleth.shared.service.reloadable;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import net.shibboleth.shared.primitive.LoggerFactory;
+
/**
* Post-processes bean definitions by marking any reloadable beans as singletons,
* and any non-reloadable beans as lazy-init to limit/prevent instantiation.
@@ -40,9 +42,11 @@ public class NonReloadableExcluder implements BeanFactoryPostProcessor {
@Nonnull private final Logger log = LoggerFactory.getLogger(NonReloadableExcluder.class);
/** {@inheritDoc} */
- public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) throws BeansException {
+ public void postProcessBeanFactory(@Nonnull final ConfigurableListableBeanFactory beanFactory)
+ throws BeansException {
for (final String beanName : beanFactory.getBeanDefinitionNames()) {
+ assert beanName != null;
final BeanDefinition beanDef = beanFactory.getBeanDefinition(beanName);
if (beanDef.getScope() != null && ReloadableScope.SCOPE_RELOADABLE.equals(beanDef.getScope())) {
log.debug("Converting reloadable bean '{}' into singleton", beanName);
diff --git a/shib-service/src/main/java/net/shibboleth/shared/service/reloadable/ReloadableScope.java b/shib-service/src/main/java/net/shibboleth/shared/service/reloadable/ReloadableScope.java
index 53d6d309..a5c51e96 100644
--- a/shib-service/src/main/java/net/shibboleth/shared/service/reloadable/ReloadableScope.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/service/reloadable/ReloadableScope.java
@@ -23,12 +23,13 @@ import javax.annotation.Nullable;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.service.ReloadableService;
import net.shibboleth.shared.service.ServiceException;
import net.shibboleth.shared.service.ServiceableComponent;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.config.Scope;
import org.springframework.context.ApplicationContext;
diff --git a/shib-service/src/main/java/net/shibboleth/shared/service/security/impl/DelegatingAccessControlService.java b/shib-service/src/main/java/net/shibboleth/shared/service/security/impl/DelegatingAccessControlService.java
index 8be32ca0..9dcfcf65 100644
--- a/shib-service/src/main/java/net/shibboleth/shared/service/security/impl/DelegatingAccessControlService.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/service/security/impl/DelegatingAccessControlService.java
@@ -21,12 +21,12 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import jakarta.servlet.ServletRequest;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.security.AccessControl;
import net.shibboleth.shared.security.AccessControlService;
import net.shibboleth.shared.service.ReloadableService;
diff --git a/shib-service/src/main/java/net/shibboleth/shared/spring/service/AbstractServiceableComponent.java b/shib-service/src/main/java/net/shibboleth/shared/spring/service/AbstractServiceableComponent.java
index f5303f8c..eddffafc 100644
--- a/shib-service/src/main/java/net/shibboleth/shared/spring/service/AbstractServiceableComponent.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/spring/service/AbstractServiceableComponent.java
@@ -23,13 +23,14 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.service.ServiceableComponent;
/**
@@ -73,9 +74,7 @@ public abstract class AbstractServiceableComponent<T> extends AbstractIdentifiab
return applicationContext;
}
- /**
- * {@inheritDoc}.
- */
+ /** {@inheritDoc} */
@Nonnull public abstract T getComponent();
/**
@@ -90,6 +89,7 @@ public abstract class AbstractServiceableComponent<T> extends AbstractIdentifiab
serviceLock.readLock().unlock();
}
+ /** {@inheritDoc} */
public void close() {
unpinComponent();
}
diff --git a/shib-service/src/main/java/net/shibboleth/shared/spring/service/ApplicationContextServiceStrategy.java b/shib-service/src/main/java/net/shibboleth/shared/spring/service/ApplicationContextServiceStrategy.java
index 4558c3ae..276d2d00 100644
--- a/shib-service/src/main/java/net/shibboleth/shared/spring/service/ApplicationContextServiceStrategy.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/spring/service/ApplicationContextServiceStrategy.java
@@ -36,7 +36,8 @@ public class ApplicationContextServiceStrategy implements
NonnullFunction<ApplicationContext, AbstractServiceableComponent<ApplicationContext>> {
/** {@inheritDoc} */
- @Nonnull public AbstractServiceableComponent<ApplicationContext> apply(@Nullable final ApplicationContext appContext) {
+ @Nonnull
+ public AbstractServiceableComponent<ApplicationContext> apply(@Nullable final ApplicationContext appContext) {
if (appContext != null) {
final ApplicationContextServiceableComponent wrapper = new ApplicationContextServiceableComponent();
diff --git a/shib-service/src/main/java/net/shibboleth/shared/spring/service/ClassBasedServiceStrategy.java b/shib-service/src/main/java/net/shibboleth/shared/spring/service/ClassBasedServiceStrategy.java
index ade63af9..bbb8400d 100644
--- a/shib-service/src/main/java/net/shibboleth/shared/spring/service/ClassBasedServiceStrategy.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/spring/service/ClassBasedServiceStrategy.java
@@ -36,7 +36,8 @@ import net.shibboleth.shared.spring.service.impl.SpringServiceableComponent;
*
* @param <T> the service type to look for
*/
-public class ClassBasedServiceStrategy<T> implements NonnullFunction<ApplicationContext, AbstractServiceableComponent<T>> {
+public class ClassBasedServiceStrategy<T>
+ implements NonnullFunction<ApplicationContext, AbstractServiceableComponent<T>> {
/** The class we are looking for. */
@Nonnull private final Class<T> serviceClaz;
diff --git a/shib-service/src/main/java/net/shibboleth/shared/spring/service/ReloadableSpringService.java b/shib-service/src/main/java/net/shibboleth/shared/spring/service/ReloadableSpringService.java
index 5e6af58c..d3deccee 100644
--- a/shib-service/src/main/java/net/shibboleth/shared/spring/service/ReloadableSpringService.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/spring/service/ReloadableSpringService.java
@@ -20,7 +20,6 @@ package net.shibboleth.shared.spring.service;
import java.io.IOException;
import java.time.Instant;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.function.Function;
@@ -29,7 +28,7 @@ import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.beans.factory.BeanNameAware;
@@ -44,9 +43,11 @@ import org.springframework.core.io.Resource;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.NonnullFunction;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.service.AbstractReloadableService;
import net.shibboleth.shared.service.ServiceException;
@@ -130,10 +131,10 @@ public class ReloadableSpringService<T> extends AbstractReloadableService<T> imp
final NonnullFunction<ApplicationContext,AbstractServiceableComponent<T>> strategy) {
theClaz = Constraint.isNotNull(claz, "Class cannot be null");
serviceStrategy = Constraint.isNotNull(strategy, "Strategy cannot be null");
- factoryPostProcessors = Collections.emptyList();
- postProcessors = Collections.emptyList();
- beanProfiles = Collections.emptyList();
- serviceConfigurations = Collections.emptyList();
+ factoryPostProcessors = CollectionSupport.emptyList();
+ postProcessors = CollectionSupport.emptyList();
+ beanProfiles = CollectionSupport.emptyList();
+ serviceConfigurations = CollectionSupport.emptyList();
}
/**
@@ -177,7 +178,8 @@ public class ReloadableSpringService<T> extends AbstractReloadableService<T> imp
public void setServiceConfigurations(@Nonnull @NonnullElements final List<Resource> configs) {
checkSetterPreconditions();
- serviceConfigurations = List.copyOf(Constraint.isNotNull(configs, "Service configurations cannot be null"));
+ serviceConfigurations = CollectionSupport.copyToList(
+ Constraint.isNotNull(configs, "Service configurations cannot be null"));
if (!serviceConfigurations.isEmpty()) {
final Instant[] lastModifiedTimes = new Instant[serviceConfigurations.size()];
@@ -227,7 +229,7 @@ public class ReloadableSpringService<T> extends AbstractReloadableService<T> imp
checkSetterPreconditions();
Constraint.isNotNull(processors, "BeanFactoryPostProcessor collection cannot be null");
- factoryPostProcessors = List.copyOf(processors);
+ factoryPostProcessors = CollectionSupport.copyToList(processors);
}
/**
@@ -239,7 +241,7 @@ public class ReloadableSpringService<T> extends AbstractReloadableService<T> imp
checkSetterPreconditions();
Constraint.isNotNull(processors, "BeanPostProcessor collection cannot be null");
- postProcessors = List.copyOf(processors);
+ postProcessors = CollectionSupport.copyToList(processors);
}
/**
diff --git a/shib-service/src/main/java/net/shibboleth/shared/spring/service/impl/SpringServiceableComponent.java b/shib-service/src/main/java/net/shibboleth/shared/spring/service/impl/SpringServiceableComponent.java
index c3ed2dc1..92d9c775 100644
--- a/shib-service/src/main/java/net/shibboleth/shared/spring/service/impl/SpringServiceableComponent.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/spring/service/impl/SpringServiceableComponent.java
@@ -33,8 +33,7 @@ import net.shibboleth.shared.spring.service.AbstractServiceableComponent;
public class SpringServiceableComponent<T> extends AbstractServiceableComponent<T> {
/** The component we are encapsulating. */
- @Nonnull final T theComponent;
-
+ @Nonnull private final T theComponent;
/**
* Constructor.
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToIPRangeConverter.java b/shib-service/src/main/java/net/shibboleth/shared/spring/service/impl/package-info.java
similarity index 66%
copy from shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToIPRangeConverter.java
copy to shib-service/src/main/java/net/shibboleth/shared/spring/service/impl/package-info.java
index b2d8ad26..e559e947 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToIPRangeConverter.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/spring/service/impl/package-info.java
@@ -15,21 +15,9 @@
* limitations under the License.
*/
-package net.shibboleth.shared.spring.config;
-
-import org.springframework.core.convert.converter.Converter;
-
-import net.shibboleth.shared.net.IPRange;
-
-
/**
- * Allows setting of {@link IPRange} properties using a CIDR string.
+ * Spring specific implementation of
+ * {@link net.shibboleth.shared.spring.service.AbstractServiceableComponent}.
*/
-public class StringToIPRangeConverter implements Converter<String,IPRange> {
- /** {@inheritDoc} */
- public IPRange convert(final String source) {
- return IPRange.parseCIDRBlock(source);
- }
-
-}
\ No newline at end of file
+package net.shibboleth.shared.spring.service.impl;
\ No newline at end of file
diff --git a/shib-service/src/test/java/net/shibboleth/shared/spring/service/NonReloadableTestBean.java b/shib-service/src/test/java/net/shibboleth/shared/spring/service/NonReloadableTestBean.java
index 8c7c6110..cc222d16 100644
--- a/shib-service/src/test/java/net/shibboleth/shared/spring/service/NonReloadableTestBean.java
+++ b/shib-service/src/test/java/net/shibboleth/shared/spring/service/NonReloadableTestBean.java
@@ -21,11 +21,11 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Test bean to canary out behavior of reloadable bean service.
diff --git a/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableBeanServiceTest.java b/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableBeanServiceTest.java
index 9870e0ed..2d7d7671 100644
--- a/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableBeanServiceTest.java
+++ b/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableBeanServiceTest.java
@@ -18,8 +18,8 @@
package net.shibboleth.shared.spring.service;
import java.io.IOException;
-import java.util.Collections;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.service.ReloadableService;
import net.shibboleth.shared.service.ServiceableComponent;
import net.shibboleth.shared.spring.util.ApplicationContextBuilder;
@@ -38,7 +38,7 @@ public class ReloadableBeanServiceTest {
try (final GenericApplicationContext appCtx = new ApplicationContextBuilder()
.setName("appCtx")
- .setServiceConfigurations(Collections.<Resource>singletonList(
+ .setServiceConfigurations(CollectionSupport.<Resource>singletonList(
new ClassPathResource("net/shibboleth/shared/spring/service/ReloadableBeans1.xml")))
.build()) {
final NonReloadableTestBean bean = appCtx.getBean("nonReloadableBean", NonReloadableTestBean.class);
diff --git a/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableSpringServiceTest.java b/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableSpringServiceTest.java
index d2d7bf05..658ced21 100644
--- a/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableSpringServiceTest.java
+++ b/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableSpringServiceTest.java
@@ -23,11 +23,11 @@ import java.io.IOException;
import java.io.OutputStream;
import java.time.Duration;
import java.time.Instant;
-import java.util.Collections;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.service.ServiceException;
import net.shibboleth.shared.service.ServiceableComponent;
import net.shibboleth.shared.spring.util.ApplicationContextBuilder;
@@ -74,7 +74,7 @@ public class ReloadableSpringServiceTest {
return new FileSystemResource(testFile);
}
- private void overwriteFileWith(final String newDataPath) throws IOException {
+ private void overwriteFileWith(@Nonnull final String newDataPath) throws IOException {
try (final OutputStream stream = new FileOutputStream(testFile)) {
ByteStreams.copy(new ClassPathResource(newDataPath).getInputStream(), stream);
}
@@ -89,7 +89,7 @@ public class ReloadableSpringServiceTest {
service.setFailFast(true);
service.setId("reloadableService");
service.setReloadCheckDelay(RELOAD_DELAY);
- service.setServiceConfigurations(Collections.singletonList(testFileResource()));
+ service.setServiceConfigurations(CollectionSupport.singletonList(testFileResource()));
service.start();
@@ -134,7 +134,7 @@ public class ReloadableSpringServiceTest {
service.setFailFast(true);
service.setId("deferedReload");
service.setReloadCheckDelay(RELOAD_DELAY);
- service.setServiceConfigurations(Collections.singletonList(testFileResource()));
+ service.setServiceConfigurations(CollectionSupport.singletonList(testFileResource()));
service.start();
@@ -194,7 +194,7 @@ public class ReloadableSpringServiceTest {
service.setFailFast(true);
service.setId("testFailFast");
service.setReloadCheckDelay(Duration.ZERO);
- service.setServiceConfigurations(Collections.singletonList(testFileResource()));
+ service.setServiceConfigurations(CollectionSupport.singletonList(testFileResource()));
try {
service.start();
@@ -233,7 +233,7 @@ public class ReloadableSpringServiceTest {
service.setFailFast(false);
service.setId("testNotFailFast");
service.setReloadCheckDelay(RELOAD_DELAY);
- service.setServiceConfigurations(Collections.singletonList(testFileResource()));
+ service.setServiceConfigurations(CollectionSupport.singletonList(testFileResource()));
service.start();
@@ -281,7 +281,7 @@ public class ReloadableSpringServiceTest {
try (final GenericApplicationContext appCtx = new ApplicationContextBuilder()
.setName("appCtx")
- .setServiceConfigurations(Collections.singletonList(parentResource))
+ .setServiceConfigurations(CollectionSupport.singletonList(parentResource))
.build()) {
final ReloadableSpringService<?> service = appCtx.getBean("testReloadableSpringService", ReloadableSpringService.class);
@@ -295,7 +295,7 @@ public class ReloadableSpringServiceTest {
try (final GenericApplicationContext appCtx = new ApplicationContextBuilder()
.setName("appCtx")
- .setServiceConfigurations(Collections.singletonList(parentResource))
+ .setServiceConfigurations(CollectionSupport.singletonList(parentResource))
.build()) {
final ReloadableSpringService<?> service1 =
appCtx.getBean("testReloadableSpringService", ReloadableSpringService.class);
diff --git a/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableTestBean.java b/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableTestBean.java
index 0e2a34ad..257b58d3 100644
--- a/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableTestBean.java
+++ b/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableTestBean.java
@@ -20,16 +20,15 @@ package net.shibboleth.shared.spring.service;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Test bean to canary out behavior of reloadable bean service.
*/
- at SuppressWarnings("javadoc")
public class ReloadableTestBean extends AbstractInitializableComponent {
@Nonnull private final Logger log = LoggerFactory.getLogger(ReloadableTestBean.class);
@@ -38,6 +37,12 @@ public class ReloadableTestBean extends AbstractInitializableComponent {
private int value;
+ /**
+ * Constructor.
+ *
+ * @param name name of bean
+ * @param val value of bean
+ */
public ReloadableTestBean(@Nonnull @NotEmpty final String name, final int val) {
id = name;
value = val;
@@ -58,6 +63,11 @@ public class ReloadableTestBean extends AbstractInitializableComponent {
super.doDestroy();
}
+ /**
+ * Get bean value.
+ *
+ * @return bean value
+ */
public int getValue() {
return value;
}
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/DeprecatedBeanDetector.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/DeprecatedBeanDetector.java
index c40c9ad1..db81fb97 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/DeprecatedBeanDetector.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/DeprecatedBeanDetector.java
@@ -70,10 +70,11 @@ public class DeprecatedBeanDetector implements ApplicationListener<ContextRefres
}
/** {@inheritDoc} */
- public void onApplicationEvent(final ContextRefreshedEvent event) {
+ public void onApplicationEvent(@Nonnull final ContextRefreshedEvent event) {
final ApplicationContext applicationContext = (ApplicationContext) event.getSource();
beanNames.forEach((k,v) -> {
+ assert k != null;
if (applicationContext.containsLocalBean(k)) {
DeprecationSupport.warn(ObjectType.BEAN, k, warnContext, v);
}
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/FunctionToFunctionConverter.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/FunctionToFunctionConverter.java
index 1830bfdd..df72cbd1 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/FunctionToFunctionConverter.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/FunctionToFunctionConverter.java
@@ -17,6 +17,8 @@
package net.shibboleth.shared.spring.config;
+import javax.annotation.Nonnull;
+
import org.springframework.core.convert.converter.Converter;
import net.shibboleth.shared.primitive.DeprecationSupport;
@@ -32,7 +34,7 @@ public class FunctionToFunctionConverter<T,R>
implements Converter<java.util.function.Function<T,R>,com.google.common.base.Function<T,R>> {
/** {@inheritDoc} */
- public com.google.common.base.Function<T,R> convert(final java.util.function.Function<T,R> source) {
+ public com.google.common.base.Function<T,R> convert(@Nonnull final java.util.function.Function<T,R> source) {
DeprecationSupport.warn(ObjectType.CLASS, com.google.common.base.Function.class.getName(), null,
java.util.function.Function.class.getName());
return source::apply;
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/IdentifiableBeanPostProcessor.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/IdentifiableBeanPostProcessor.java
index 23cb89ea..14f59b2b 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/IdentifiableBeanPostProcessor.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/IdentifiableBeanPostProcessor.java
@@ -20,10 +20,11 @@ package net.shibboleth.shared.spring.config;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.config.BeanPostProcessor;
import net.shibboleth.shared.component.IdentifiableComponent;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Pre-processes {@link IdentifiableComponent} beans by setting the bean ID to the bean name.
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/IdentifiedComponentManager.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/IdentifiedComponentManager.java
index 16d534ba..51a28181 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/IdentifiedComponentManager.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/IdentifiedComponentManager.java
@@ -18,19 +18,18 @@
package net.shibboleth.shared.spring.config;
import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashSet;
-import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.IdentifiedComponent;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Class used for auto-wiring free-standing identified objects along with explicitly declared
@@ -64,9 +63,9 @@ public class IdentifiedComponentManager<T extends IdentifiedComponent> {
*/
public IdentifiedComponentManager(@Nullable @NonnullElements final Collection<T> freeObjects) {
if (freeObjects != null) {
- initialComponents = List.copyOf(freeObjects);
+ initialComponents = CollectionSupport.copyToList(freeObjects);
} else {
- initialComponents = Collections.emptyList();
+ initialComponents = CollectionSupport.emptyList();
}
components = initialComponents;
}
@@ -92,7 +91,7 @@ public class IdentifiedComponentManager<T extends IdentifiedComponent> {
return true;
})
.collect(Collectors.toUnmodifiableList()));
- components = List.copyOf(holder);
+ components = CollectionSupport.copyToList(holder);
} else {
components = initialComponents;
}
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/PredicateToPredicateConverter.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/PredicateToPredicateConverter.java
index 06583d57..06d266da 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/PredicateToPredicateConverter.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/PredicateToPredicateConverter.java
@@ -17,6 +17,8 @@
package net.shibboleth.shared.spring.config;
+import javax.annotation.Nonnull;
+
import org.springframework.core.convert.converter.Converter;
import net.shibboleth.shared.primitive.DeprecationSupport;
@@ -31,7 +33,7 @@ public class PredicateToPredicateConverter<T>
implements Converter<java.util.function.Predicate<T>,com.google.common.base.Predicate<T>> {
/** {@inheritDoc} */
- public com.google.common.base.Predicate<T> convert(final java.util.function.Predicate<T> source) {
+ public com.google.common.base.Predicate<T> convert(@Nonnull final java.util.function.Predicate<T> source) {
DeprecationSupport.warn(ObjectType.CLASS, com.google.common.base.Predicate.class.getName(), null,
java.util.function.Predicate.class.getName());
return source::test;
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/RelocatedBeanFactoryPostProcessor.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/RelocatedBeanFactoryPostProcessor.java
index f643ff08..50a2c149 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/RelocatedBeanFactoryPostProcessor.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/RelocatedBeanFactoryPostProcessor.java
@@ -17,7 +17,6 @@
package net.shibboleth.shared.spring.config;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -30,6 +29,7 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.primitive.DeprecationSupport;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
@@ -49,8 +49,8 @@ public class RelocatedBeanFactoryPostProcessor implements BeanFactoryPostProcess
/** Constructor. */
public RelocatedBeanFactoryPostProcessor() {
- movedClasses = Collections.emptyMap();
- movedBeans = Collections.emptyMap();
+ movedClasses = CollectionSupport.emptyMap();
+ movedBeans = CollectionSupport.emptyMap();
}
/**
@@ -86,10 +86,11 @@ public class RelocatedBeanFactoryPostProcessor implements BeanFactoryPostProcess
}
/** {@inheritDoc} */
- @Override
- public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) throws BeansException {
+ public void postProcessBeanFactory(@Nonnull final ConfigurableListableBeanFactory beanFactory)
+ throws BeansException {
for (final String name : beanFactory.getBeanDefinitionNames()) {
+ assert name != null;
final BeanDefinition def = beanFactory.getBeanDefinition(name);
final String className = def.getBeanClassName();
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringBooleanToPredicateConverter.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringBooleanToPredicateConverter.java
index 5d709c1b..128281d6 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringBooleanToPredicateConverter.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringBooleanToPredicateConverter.java
@@ -22,11 +22,11 @@ import java.util.function.Predicate;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.core.convert.converter.Converter;
-import com.google.common.base.Predicates;
+import org.springframework.core.convert.converter.Converter;
+import net.shibboleth.shared.logic.PredicateSupport;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
/**
@@ -38,11 +38,11 @@ public class StringBooleanToPredicateConverter implements Converter<String,Predi
@Nonnull private final Logger log = LoggerFactory.getLogger(StringBooleanToPredicateConverter.class);
/** {@inheritDoc} */
- public Predicate<?> convert(final String source) {
+ public Predicate<?> convert(@Nonnull final String source) {
final String trimmed = StringSupport.trimOrNull(source);
if (Boolean.valueOf(trimmed)) {
- return Predicates.alwaysTrue();
+ return PredicateSupport.alwaysTrue();
}
if (trimmed != null) {
@@ -50,9 +50,11 @@ public class StringBooleanToPredicateConverter implements Converter<String,Predi
log.warn("The value '1' is not treated as 'true'; if intentional, explicitly use 'false'");
} else if (!"false".equalsIgnoreCase(trimmed) && !"0".equals(trimmed)) {
log.warn("Unrecognized value '{}' converted to false; if intentional, explicitly use 'false'", trimmed);
+ // TODO: should we be returning null instead?
}
}
- return Predicates.alwaysFalse();
+
+ return PredicateSupport.alwaysFalse();
}
}
\ No newline at end of file
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToDurationConverter.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToDurationConverter.java
index 9b2d5817..987f0ea2 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToDurationConverter.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToDurationConverter.java
@@ -19,6 +19,8 @@ package net.shibboleth.shared.spring.config;
import java.time.Duration;
+import javax.annotation.Nonnull;
+
import org.springframework.core.convert.converter.Converter;
import net.shibboleth.shared.xml.DOMTypeSupport;
@@ -29,7 +31,7 @@ import net.shibboleth.shared.xml.DOMTypeSupport;
public class StringToDurationConverter implements Converter<String,Duration> {
/** {@inheritDoc} */
- public Duration convert(final String source) {
+ public Duration convert(@Nonnull final String source) {
if (source.startsWith("P") || source.startsWith("-P")) {
return DOMTypeSupport.stringToDuration(source.trim());
}
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToIPRangeConverter.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToIPRangeConverter.java
index b2d8ad26..a711c36b 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToIPRangeConverter.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToIPRangeConverter.java
@@ -17,6 +17,8 @@
package net.shibboleth.shared.spring.config;
+import javax.annotation.Nonnull;
+
import org.springframework.core.convert.converter.Converter;
import net.shibboleth.shared.net.IPRange;
@@ -28,7 +30,7 @@ import net.shibboleth.shared.net.IPRange;
public class StringToIPRangeConverter implements Converter<String,IPRange> {
/** {@inheritDoc} */
- public IPRange convert(final String source) {
+ public IPRange convert(@Nonnull final String source) {
return IPRange.parseCIDRBlock(source);
}
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToPeriodConverter.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToPeriodConverter.java
index 7cd31913..61f38bab 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToPeriodConverter.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToPeriodConverter.java
@@ -19,6 +19,8 @@ package net.shibboleth.shared.spring.config;
import java.time.Period;
+import javax.annotation.Nonnull;
+
import org.springframework.core.convert.converter.Converter;
/**
@@ -27,7 +29,7 @@ import org.springframework.core.convert.converter.Converter;
public class StringToPeriodConverter implements Converter<String,Period> {
/** {@inheritDoc} */
- public Period convert(final String source) {
+ public Period convert(@Nonnull final String source) {
if (source.startsWith("P") || source.startsWith("-P")) {
return Period.parse(source);
}
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToResourceConverter.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToResourceConverter.java
index 18afc77a..7f9b0ace 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToResourceConverter.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/StringToResourceConverter.java
@@ -20,12 +20,13 @@ package net.shibboleth.shared.spring.config;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.resource.Resource;
import net.shibboleth.shared.spring.resource.PreferFileSystemResourceLoader;
import net.shibboleth.shared.spring.resource.ResourceHelper;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.convert.converter.Converter;
@@ -67,7 +68,7 @@ public class StringToResourceConverter implements Converter<String, Resource>, A
}
/** {@inheritDoc} */
- public void setApplicationContext(@Nullable final ApplicationContext context) {
+ public void setApplicationContext(@Nonnull final ApplicationContext context) {
applicationContext = context;
}
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/AbstractPropertiesApplicationContextInitializer.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/AbstractPropertiesApplicationContextInitializer.java
index 263a9137..f34421e8 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/AbstractPropertiesApplicationContextInitializer.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/AbstractPropertiesApplicationContextInitializer.java
@@ -39,7 +39,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.PropertiesPropertySource;
@@ -52,6 +52,7 @@ import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.ConstraintViolationException;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
/**
@@ -165,6 +166,7 @@ public abstract class AbstractPropertiesApplicationContextInitializer
if (File.separatorChar == '\\') {
searchLocationAbsolutePath = searchLocationAbsolutePath.replace('\\', '/');
}
+ assert searchLocationAbsolutePath != null;
setHomeProperty(searchLocationAbsolutePath, properties);
}
@@ -313,6 +315,7 @@ public abstract class AbstractPropertiesApplicationContextInitializer
@Nonnull final String searchLocation, @Nonnull final Properties properties) {
for (final String source : getAdditionalSources(searchLocation, properties)) {
+ assert source != null;
LOG.debug("Attempting to load properties from resource '{}'", source);
final Resource additionalResource = applicationContext.getResource(source);
if (additionalResource.exists()) {
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/AbstractCustomBeanDefinitionParser.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/AbstractCustomBeanDefinitionParser.java
index fb822d19..0ed25506 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/AbstractCustomBeanDefinitionParser.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/AbstractCustomBeanDefinitionParser.java
@@ -20,11 +20,13 @@ package net.shibboleth.shared.spring.custom;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
+import net.shibboleth.shared.primitive.LoggerFactory;
+
/**
* This is the base parser for all our custom syntax.
*
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/BaseSpringNamespaceHandler.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/BaseSpringNamespaceHandler.java
index f4341195..9fe219b9 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/BaseSpringNamespaceHandler.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/BaseSpringNamespaceHandler.java
@@ -32,7 +32,7 @@ import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.BeanInstantiationException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanCreationException;
@@ -47,6 +47,7 @@ import org.w3c.dom.Node;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.xml.DOMTypeSupport;
import net.shibboleth.shared.xml.QNameSupport;
@@ -116,8 +117,8 @@ public abstract class BaseSpringNamespaceHandler implements NamespaceHandler {
*
* @return the input bean definition
*/
- @Override public BeanDefinitionHolder decorate(@Nonnull final Node node, @Nonnull final BeanDefinitionHolder definition,
- @Nonnull final ParserContext parserContext) {
+ @Nonnull public BeanDefinitionHolder decorate(@Nonnull final Node node,
+ @Nonnull final BeanDefinitionHolder definition, @Nonnull final ParserContext parserContext) {
return definition;
}
@@ -130,7 +131,7 @@ public abstract class BaseSpringNamespaceHandler implements NamespaceHandler {
*
* @return the bean definition created from the given element
*/
- @Override public BeanDefinition parse(@Nonnull final Element element, @Nonnull final ParserContext parserContext) {
+ @Nullable public BeanDefinition parse(@Nonnull final Element element, @Nonnull final ParserContext parserContext) {
return findParserForElement(element).parse(element, parserContext);
}
@@ -187,7 +188,8 @@ public abstract class BaseSpringNamespaceHandler implements NamespaceHandler {
* @param elementNameOrType the element name or schema type the parser is for
* @param parser the parser to register
*/
- protected void registerBeanDefinitionParser(@Nonnull final QName elementNameOrType, @Nonnull final BeanDefinitionParser parser) {
+ protected void registerBeanDefinitionParser(@Nonnull final QName elementNameOrType,
+ @Nonnull final BeanDefinitionParser parser) {
parsers.put(elementNameOrType, parser);
}
@@ -211,6 +213,7 @@ public abstract class BaseSpringNamespaceHandler implements NamespaceHandler {
@SuppressWarnings("unchecked")
final Class<SecondaryNamespaceHandler> clazz =
(Class<SecondaryNamespaceHandler>) Class.forName(className);
+ assert clazz != null;
final SecondaryNamespaceHandler namespaceHandler = BeanUtils.instantiateClass(clazz);
namespaceHandler.init(parsers);
}
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/EmbeddedAndSchemaAwareReader.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/EmbeddedAndSchemaAwareReader.java
index 4cf98fd2..0f35d848 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/EmbeddedAndSchemaAwareReader.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/EmbeddedAndSchemaAwareReader.java
@@ -42,7 +42,8 @@ public class EmbeddedAndSchemaAwareReader extends SchemaTypeAwareBeanDefinitionD
* with the <beans> statement) and then we call again to handle the beans statements which
* we have explicitly pulled out.
* */
- @Override public void registerBeanDefinitions(@Nonnull final Document doc, @Nonnull final XmlReaderContext readerContext)
+ @Override
+ public void registerBeanDefinitions(@Nonnull final Document doc, @Nonnull final XmlReaderContext readerContext)
throws BeanDefinitionStoreException {
super.registerBeanDefinitions(doc, readerContext);
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/LocalOnlyResourceEntityResolver.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/LocalOnlyResourceEntityResolver.java
index 0128f8c4..d360f689 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/LocalOnlyResourceEntityResolver.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/LocalOnlyResourceEntityResolver.java
@@ -27,8 +27,11 @@ import javax.annotation.Nullable;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+
+import net.shibboleth.shared.primitive.LoggerFactory;
+
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.xml.DelegatingEntityResolver;
import org.springframework.beans.factory.xml.ResourceEntityResolver;
import org.springframework.core.io.Resource;
@@ -41,87 +44,88 @@ import org.springframework.util.ResourceUtils;
*/
public class LocalOnlyResourceEntityResolver extends DelegatingEntityResolver {
- @Nonnull private final Logger log = LoggerFactory.getLogger(LocalOnlyResourceEntityResolver.class);
-
- @Nonnull private final ResourceLoader resourceLoader;
-
- /**
- * Create a ResourceEntityResolver for the specified ResourceLoader
- * (usually, an ApplicationContext).
- *
- * @param loader the ResourceLoader (or ApplicationContext)
- * to load XML entity includes with
- */
- public LocalOnlyResourceEntityResolver(@Nonnull final ResourceLoader loader) {
- super(loader.getClassLoader());
- resourceLoader = loader;
- }
-
- /** {@inheritDoc} */
- @Override
- @Nullable public InputSource resolveEntity(@Nullable final String publicId, @Nullable final String systemId)
- throws SAXException, IOException {
-
- InputSource source = super.resolveEntity(publicId, systemId);
-
- if (source == null && systemId != null) {
- String resourcePath = null;
- try {
- String decodedSystemId = URLDecoder.decode(systemId, StandardCharsets.UTF_8);
- assert decodedSystemId != null;
- String givenUrl = ResourceUtils.toURL(decodedSystemId).toString();
- String systemRootUrl = new File("").toURI().toURL().toString();
- // Try relative to resource base if currently in system root.
- if (givenUrl.startsWith(systemRootUrl)) {
- resourcePath = givenUrl.substring(systemRootUrl.length());
- }
- }
- catch (Exception ex) {
- // Typically a MalformedURLException or AccessControlException.
- log.debug("Could not resolve XML entity [{}] against system root URL", systemId, ex);
- // No URL (or no resolvable URL) -> try relative to resource base.
- resourcePath = systemId;
- }
- if (resourcePath != null) {
- log.trace("Trying to locate XML entity [{}] as resource [{}]", systemId, resourcePath);
- Resource resource = this.resourceLoader.getResource(resourcePath);
- source = new InputSource(resource.getInputStream());
- source.setPublicId(publicId);
- source.setSystemId(systemId);
- log.debug("Found XML entity [{}]:", systemId, resource);
- }
- else if (systemId.endsWith(DTD_SUFFIX) || systemId.endsWith(XSD_SUFFIX)) {
- // External dtd/xsd lookup via https even for canonical http declaration
- String url = systemId;
- if (url.startsWith("http:")) {
- url = "https:" + url.substring(5);
- }
-
- log.warn("Blocking attempted remote resolution of [{}]", systemId);
- // If we don't throw here, Java's broken parser just blindly proceeds with its own
- // internal entity resolution.
- throw new IOException("Blocked atttempted remote resolution");
+ /** Class logger. */
+ @Nonnull private final Logger log = LoggerFactory.getLogger(LocalOnlyResourceEntityResolver.class);
+
+ /** Resource loader. */
+ @Nonnull private final ResourceLoader resourceLoader;
+
+ /**
+ * Create a ResourceEntityResolver for the specified ResourceLoader
+ * (usually, an ApplicationContext).
+ *
+ * @param loader the ResourceLoader (or ApplicationContext)
+ * to load XML entity includes with
+ */
+ public LocalOnlyResourceEntityResolver(@Nonnull final ResourceLoader loader) {
+ super(loader.getClassLoader());
+ resourceLoader = loader;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @Nullable public InputSource resolveEntity(@Nullable final String publicId, @Nullable final String systemId)
+ throws SAXException, IOException {
+
+ InputSource source = super.resolveEntity(publicId, systemId);
+
+ if (source == null && systemId != null) {
+ String resourcePath = null;
+ try {
+ final String decodedSystemId = URLDecoder.decode(systemId, StandardCharsets.UTF_8);
+ assert decodedSystemId != null;
+ final String givenUrl = ResourceUtils.toURL(decodedSystemId).toString();
+ final String systemRootUrl = new File("").toURI().toURL().toString();
+ // Try relative to resource base if currently in system root.
+ if (givenUrl.startsWith(systemRootUrl)) {
+ resourcePath = givenUrl.substring(systemRootUrl.length());
+ }
+ } catch (final Exception ex) {
+ // Typically a MalformedURLException or AccessControlException.
+ log.debug("Could not resolve XML entity [{}] against system root URL", systemId, ex);
+ // No URL (or no resolvable URL) -> try relative to resource base.
+ resourcePath = systemId;
+ }
+
+ if (resourcePath != null) {
+ log.trace("Trying to locate XML entity [{}] as resource [{}]", systemId, resourcePath);
+ final Resource resource = this.resourceLoader.getResource(resourcePath);
+ source = new InputSource(resource.getInputStream());
+ source.setPublicId(publicId);
+ source.setSystemId(systemId);
+ log.debug("Found XML entity [{}]:", systemId, resource);
+ } else if (systemId.endsWith(DTD_SUFFIX) || systemId.endsWith(XSD_SUFFIX)) {
+ // External dtd/xsd lookup via https even for canonical http declaration
+ String url = systemId;
+ if (url.startsWith("http:")) {
+ url = "https:" + url.substring(5);
+ }
+
+ log.warn("Blocking attempted remote resolution of [{}]", systemId);
+ // If we don't throw here, Java's broken parser just blindly proceeds with its own
+ // internal entity resolution.
+ throw new IOException("Blocked atttempted remote resolution");
// This is being elided.
- /*
- try {
- source = new InputSource(ResourceUtils.toURL(url).openStream());
- source.setPublicId(publicId);
- source.setSystemId(systemId);
- }
- catch (IOException ex) {
- if (logger.isDebugEnabled()) {
- logger.debug("Could not resolve XML entity [" + systemId + "] through URL [" + url + "]", ex);
- }
- // Fall back to the parser's default behavior.
- source = null;
- }
- */
- }
- }
-
- return source;
- }
+ /*
+ try {
+ source = new InputSource(ResourceUtils.toURL(url).openStream());
+ source.setPublicId(publicId);
+ source.setSystemId(systemId);
+ }
+ catch (IOException ex) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Could not resolve XML entity [" + systemId + "] through URL [" + url + "]", ex);
+ }
+ // Fall back to the parser's default behavior.
+ source = null;
+ }
+ */
+ }
+ }
+
+ return source;
+ }
}
\ No newline at end of file
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionParserDelegate.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionParserDelegate.java
index 137d134b..0d92c8d3 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionParserDelegate.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionParserDelegate.java
@@ -65,6 +65,7 @@ public class SchemaTypeAwareBeanDefinitionParserDelegate extends BeanDefinitionP
}
}
+ assert namespaceUri != null;
final NamespaceHandler handler = getReaderContext().getNamespaceHandlerResolver().resolve(namespaceUri);
if (handler == null) {
error("Unable to locate NamespaceHandler for namespace [" + namespaceUri + "]", element);
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareXMLBeanDefinitionReader.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareXMLBeanDefinitionReader.java
index 4125e261..ff96048f 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareXMLBeanDefinitionReader.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareXMLBeanDefinitionReader.java
@@ -48,8 +48,7 @@ public class SchemaTypeAwareXMLBeanDefinitionReader extends XmlBeanDefinitionRea
final ResourceLoader resourceLoader = getResourceLoader();
if (resourceLoader != null) {
setEntityResolver(new LocalOnlyResourceEntityResolver(resourceLoader));
- }
- else {
+ } else {
setEntityResolver(new DelegatingEntityResolver(getBeanClassLoader()));
}
}
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SecondaryNamespaceHandler.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SecondaryNamespaceHandler.java
index 98d2b9ca..af68181a 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SecondaryNamespaceHandler.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SecondaryNamespaceHandler.java
@@ -17,7 +17,6 @@
package net.shibboleth.shared.spring.custom;
-import java.util.Collections;
import java.util.Map;
import javax.annotation.Nonnull;
@@ -27,6 +26,7 @@ import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.w3c.dom.Element;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
/**
@@ -44,7 +44,7 @@ public abstract class SecondaryNamespaceHandler {
/** Constructor. */
public SecondaryNamespaceHandler() {
- parsers = Collections.emptyMap();
+ parsers = CollectionSupport.emptyMap();
}
/**
@@ -66,7 +66,8 @@ public abstract class SecondaryNamespaceHandler {
* @param elementNameOrType the element name or schema type the parser is for
* @param parser the parser to register
*/
- protected void registerBeanDefinitionParser(@Nonnull final QName elementNameOrType, @Nonnull final BeanDefinitionParser parser) {
+ protected void registerBeanDefinitionParser(@Nonnull final QName elementNameOrType,
+ @Nonnull final BeanDefinitionParser parser) {
parsers.put(elementNameOrType, parser);
}
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/error/ErrorRaisingController.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/error/ErrorRaisingController.java
index 2742aeb6..3ea4f679 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/error/ErrorRaisingController.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/error/ErrorRaisingController.java
@@ -20,11 +20,12 @@ package net.shibboleth.shared.spring.error;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* MVC controller for responding to errors by dispatching them to the MVC error handling umbrella.
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/AbstractSpringExpressionEvaluator.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/AbstractSpringExpressionEvaluator.java
index dfa130b3..fa660209 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/AbstractSpringExpressionEvaluator.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/AbstractSpringExpressionEvaluator.java
@@ -21,7 +21,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
@@ -30,6 +30,7 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
/**
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiConsumer.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiConsumer.java
index e7dccf20..3c24cc29 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiConsumer.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiConsumer.java
@@ -23,12 +23,13 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.expression.EvaluationContext;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.collection.Pair;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Predicate whose condition is defined by an Spring EL expression.
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiFunction.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiFunction.java
index 84781507..bc4b0c33 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiFunction.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiFunction.java
@@ -23,12 +23,13 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.expression.EvaluationContext;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.collection.Pair;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Predicate whose condition is defined by an Spring EL expression.
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiPredicate.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiPredicate.java
index 54783372..696dfb98 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiPredicate.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionBiPredicate.java
@@ -23,12 +23,13 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.expression.EvaluationContext;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.collection.Pair;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Predicate whose condition is defined by an Spring EL expression.
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionConsumer.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionConsumer.java
index 4d6e5f64..999467f0 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionConsumer.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionConsumer.java
@@ -23,11 +23,12 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.expression.EvaluationContext;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Predicate whose condition is defined by an Spring EL expression.
@@ -36,8 +37,7 @@ import net.shibboleth.shared.annotation.constraint.NotEmpty;
*
* @since 6.1.0
*/
-public class SpringExpressionConsumer<T> extends AbstractSpringExpressionEvaluator
- implements Consumer<T> {
+public class SpringExpressionConsumer<T> extends AbstractSpringExpressionEvaluator implements Consumer<T> {
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(SpringExpressionConsumer.class);
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionFunction.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionFunction.java
index 5a474b8c..1f1f6020 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionFunction.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionFunction.java
@@ -23,11 +23,12 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.expression.EvaluationContext;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Function whose output is defined by an Spring EL expression.
@@ -37,8 +38,7 @@ import net.shibboleth.shared.annotation.constraint.NotEmpty;
*
* @since 5.4.0
*/
-public class SpringExpressionFunction<T,U> extends AbstractSpringExpressionEvaluator
- implements Function<T,U> {
+public class SpringExpressionFunction<T,U> extends AbstractSpringExpressionEvaluator implements Function<T,U> {
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(SpringExpressionFunction.class);
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionPredicate.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionPredicate.java
index 8de8267b..1a55f3cc 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionPredicate.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/expression/SpringExpressionPredicate.java
@@ -21,11 +21,13 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.expression.EvaluationContext;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.primitive.LoggerFactory;
+
import java.util.function.Predicate;
/**
@@ -35,8 +37,7 @@ import java.util.function.Predicate;
*
* @since 5.4.0
*/
-public class SpringExpressionPredicate<T> extends AbstractSpringExpressionEvaluator
- implements Predicate<T> {
+public class SpringExpressionPredicate<T> extends AbstractSpringExpressionEvaluator implements Predicate<T> {
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(SpringExpressionPredicate.class);
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/EvaluableScriptFactoryBean.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/EvaluableScriptFactoryBean.java
index a8398a83..befb6bd2 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/EvaluableScriptFactoryBean.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/EvaluableScriptFactoryBean.java
@@ -22,11 +22,12 @@ import java.io.InputStream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.scripting.EvaluableScript;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.core.io.Resource;
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ConditionalResource.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ConditionalResource.java
index 1278d7b3..ba47ba92 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ConditionalResource.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ConditionalResource.java
@@ -29,7 +29,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.core.io.Resource;
@@ -37,6 +37,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ConditionalResourceResolver.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ConditionalResourceResolver.java
index b62e2cfc..b0d72e0b 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ConditionalResourceResolver.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ConditionalResourceResolver.java
@@ -45,7 +45,7 @@ public class ConditionalResourceResolver implements ProtocolResolver {
}
/** {@inheritDoc} */
- public Resource resolve(final String location, final ResourceLoader resourceLoader) {
+ public Resource resolve(@Nonnull final String location, @Nonnull final ResourceLoader resourceLoader) {
if (location.startsWith(CONDITIONAL_RESOURCE_PREFIX)) {
final Resource wrapped = resourceLoader.getResource(
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/RunnableFileSystemResource.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/RunnableFileSystemResource.java
index bd0b3fc5..bd0b4557 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/RunnableFileSystemResource.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/RunnableFileSystemResource.java
@@ -24,13 +24,14 @@ import java.io.InputStream;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.core.io.FileSystemResource;
import net.shibboleth.shared.annotation.ParameterName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.resource.Resource;
/**
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/util/ApplicationContextBuilder.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/util/ApplicationContextBuilder.java
index db62a826..74f53e1f 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/util/ApplicationContextBuilder.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/util/ApplicationContextBuilder.java
@@ -31,6 +31,7 @@ import javax.annotation.Nullable;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.spring.config.BooleanToPredicateConverter;
import net.shibboleth.shared.spring.config.FunctionToFunctionConverter;
@@ -45,7 +46,7 @@ import net.shibboleth.shared.spring.resource.ConditionalResourceResolver;
import net.shibboleth.shared.spring.resource.PreferFileSystemResourceLoader;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.ApplicationContext;
@@ -369,6 +370,7 @@ public class ApplicationContextBuilder {
if (beanProfiles != null) {
final String[] profiles = beanProfiles.toArray(new String[0]);
+ assert profiles != null;
context.getEnvironment().setActiveProfiles(profiles);
}
@@ -389,6 +391,7 @@ public class ApplicationContextBuilder {
configurationSources.stream().forEachOrdered(
s -> {
try {
+ assert s != null;
final Resource[] loaded = context.getResources(s);
if (loaded != null && loaded.length > 0) {
log.debug("Resolved resources: {}", Arrays.asList(loaded));
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java
index 891007b0..bcd826c4 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/util/SpringSupport.java
@@ -30,7 +30,7 @@ import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.config.BeanDefinition;
@@ -52,7 +52,9 @@ import com.google.common.base.Strings;
import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.servlet.HttpServletSupport;
import net.shibboleth.shared.spring.context.FilesystemGenericApplicationContext;
@@ -348,6 +350,6 @@ public final class SpringSupport {
}
}
outList.addAll(fromBrowser);
- return List.copyOf(outList);
+ return CollectionSupport.copyToList(outList);
}
}
\ No newline at end of file
diff --git a/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java b/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java
index 31b118d7..2a8c07cb 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/scripting/AbstractScriptEvaluator.java
@@ -18,7 +18,6 @@
package net.shibboleth.shared.scripting;
import java.util.Collection;
-import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -181,7 +180,7 @@ public abstract class AbstractScriptEvaluator {
@Nullable @NonnullElements final Collection<? extends ScriptContextExtender> extenders) {
if (extenders != null) {
- contextExtenders = List.copyOf(extenders);
+ contextExtenders = CollectionSupport.copyToList(extenders);
} else {
contextExtenders = CollectionSupport.emptyList();
}
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/AttributeSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/AttributeSupport.java
index 8bbfa30c..3d145aba 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/AttributeSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/AttributeSupport.java
@@ -27,6 +27,7 @@ import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.StringSupport;
@@ -356,7 +357,7 @@ public final class AttributeSupport {
*/
@Nonnull public static List<String> getAttributeValueAsList(@Nullable final Attr attribute) {
if (attribute == null) {
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
return StringSupport.stringToList(attribute.getValue(), XMLConstants.LIST_DELIMITERS);
}
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/ElementSupport.java b/shib-support/src/main/java/net/shibboleth/shared/xml/ElementSupport.java
index fee2e2d7..335678f6 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/ElementSupport.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/ElementSupport.java
@@ -18,7 +18,6 @@
package net.shibboleth.shared.xml;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -28,6 +27,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.xml.namespace.QName;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.StringSupport;
@@ -150,7 +150,7 @@ public final class ElementSupport {
@Nonnull public static List<Element> getChildElements(@Nullable final Node root) {
if (root == null) {
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
final ArrayList<Element> children = new ArrayList<>();
@@ -175,7 +175,7 @@ public final class ElementSupport {
*/
@Nonnull public static List<Element> getChildElements(@Nullable final Node root, @Nullable final QName name) {
if (root == null || name == null) {
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
return getChildElementsByTagNameNS(root, name.getNamespaceURI(), name.getLocalPart());
@@ -210,7 +210,7 @@ public final class ElementSupport {
@Nonnull public static List<Element> getChildElementsByTagName(@Nullable final Node root,
@Nullable final String localName) {
if (root == null) {
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
final ArrayList<Element> children = new ArrayList<>();
@@ -239,7 +239,7 @@ public final class ElementSupport {
@Nonnull public static List<Element> getChildElementsByTagNameNS(@Nullable final Node root,
@Nullable final String namespaceURI, @Nullable final String localName) {
if (root == null || localName == null) {
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
final ArrayList<Element> children = new ArrayList<>();
@@ -311,7 +311,7 @@ public final class ElementSupport {
*/
@Nonnull public static List<String> getElementContentAsList(@Nullable final Element element) {
if (element == null) {
- return Collections.emptyList();
+ return CollectionSupport.emptyList();
}
return StringSupport.stringToList(getElementContentAsString(element), XMLConstants.LIST_DELIMITERS);
}
@@ -373,7 +373,7 @@ public final class ElementSupport {
*/
@Nonnull public static Map<QName, List<Element>> getIndexedChildElements(@Nullable final Element root) {
if (root == null) {
- return Collections.emptyMap();
+ return CollectionSupport.emptyMap();
}
final Map<QName, List<Element>> children = new HashMap<>();
diff --git a/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
index 7454b80a..43788733 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/xml/impl/BasicParserPool.java
@@ -50,6 +50,7 @@ import com.google.common.collect.Maps;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.NullableElements;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
@@ -314,11 +315,11 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
}
/**
- * Gets the builder attributes used when creating builders. This collection is unmodifiable.
+ * Gets the builder attributes used when creating builders.
*
* @return builder attributes used when creating builders
*/
- @Nonnull @NonnullElements public Map<String, Object> getBuilderAttributes() {
+ @Nonnull @NonnullElements @Unmodifiable @NotLive public Map<String, Object> getBuilderAttributes() {
return Collections.unmodifiableMap(builderAttributes);
}
@@ -378,11 +379,11 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
}
/**
- * Gets the builders' features. This collection is unmodifiable.
+ * Gets the builders' features.
*
* @return the builders' features
*/
- @Nonnull @NonnullElements @Unmodifiable public Map<String, Boolean> getBuilderFeatures() {
+ @Nonnull @NonnullElements @Unmodifiable @NotLive public Map<String, Boolean> getBuilderFeatures() {
return builderFeatures;
}
@@ -397,7 +398,7 @@ public class BasicParserPool extends AbstractInitializableComponent implements P
if (newFeatures == null) {
builderFeatures = CollectionSupport.emptyMap();
} else {
- builderFeatures = Map.copyOf(Maps.filterKeys(newFeatures, Predicates.notNull()));
+ builderFeatures = Collections.unmodifiableMap(Maps.filterKeys(newFeatures, Predicates.notNull()));
}
}
diff --git a/shib-testing/src/main/java/net/shibboleth/shared/testing/ConstantSupplier.java b/shib-testing/src/main/java/net/shibboleth/shared/testing/ConstantSupplier.java
index faf392f6..012d8496 100644
--- a/shib-testing/src/main/java/net/shibboleth/shared/testing/ConstantSupplier.java
+++ b/shib-testing/src/main/java/net/shibboleth/shared/testing/ConstantSupplier.java
@@ -23,7 +23,9 @@ import net.shibboleth.shared.primitive.NonnullSupplier;
/**
* Implementaion of {@link NonnullSupplier} which returns an unchanging
- * value/
+ * value.
+ *
+ * @param <T> type of supplier
*/
public final class ConstantSupplier<T> implements NonnullSupplier<T> {
@@ -44,4 +46,4 @@ public final class ConstantSupplier<T> implements NonnullSupplier<T> {
return theValue;
}
-}
+}
\ No newline at end of file
diff --git a/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/SpringResourceLoader.java b/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/SpringResourceLoader.java
index 6b75aa5b..32007a2f 100644
--- a/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/SpringResourceLoader.java
+++ b/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/SpringResourceLoader.java
@@ -30,10 +30,11 @@ import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.runtime.resource.loader.ResourceLoader;
import org.apache.velocity.util.ExtProperties;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.util.StringUtils;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.primitive.LoggerFactory;
/**
* Velocity ResourceLoader adapter that loads via a Spring ResourceLoader.
diff --git a/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/VelocityEngineFactory.java b/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/VelocityEngineFactory.java
index fe8fe48e..3e4f5893 100644
--- a/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/VelocityEngineFactory.java
+++ b/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/VelocityEngineFactory.java
@@ -32,7 +32,7 @@ import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.exception.VelocityException;
import org.apache.velocity.runtime.RuntimeConstants;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
@@ -40,6 +40,8 @@ import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
+import net.shibboleth.shared.primitive.LoggerFactory;
+
/**
* Factory that configures a VelocityEngine. Can be used standalone,
* but typically you will either use {@link VelocityEngineFactoryBean}
diff --git a/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/VelocityView.java b/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/VelocityView.java
index 83e753de..0331f47b 100644
--- a/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/VelocityView.java
+++ b/shib-velocity-spring/src/main/java/net/shibboleth/shared/spring/velocity/VelocityView.java
@@ -36,8 +36,8 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextException;
import org.springframework.web.servlet.view.AbstractTemplateView;
-import org.springframework.web.util.NestedServletException;
+import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@@ -229,8 +229,8 @@ public class VelocityView extends AbstractTemplateView {
* @throws Exception if there's a fatal error while rendering the model
*/
@Override
- protected void renderMergedTemplateModel(final Map<String,Object> model,
- final HttpServletRequest request, final HttpServletResponse response) throws Exception {
+ protected void renderMergedTemplateModel(@Nonnull final Map<String,Object> model,
+ @Nonnull final HttpServletRequest request, @Nonnull final HttpServletResponse response) throws Exception {
final Context velocityContext = createVelocityContext(model, request, response);
@@ -254,7 +254,7 @@ public class VelocityView extends AbstractTemplateView {
*
* @throws Exception if there's a fatal error while creating the context
*/
- protected Context createVelocityContext(@Nullable final Map<String,Object> model,
+ @Nonnull protected Context createVelocityContext(@Nullable final Map<String,Object> model,
@Nonnull final HttpServletRequest request, @Nonnull final HttpServletResponse response) throws Exception {
return createVelocityContext(model);
@@ -274,7 +274,7 @@ public class VelocityView extends AbstractTemplateView {
*
* @throws Exception if there's a fatal error while creating the context
*/
- protected Context createVelocityContext(final Map<String, Object> model) throws Exception {
+ @Nonnull protected Context createVelocityContext(final Map<String, Object> model) throws Exception {
return new VelocityContext(model);
}
@@ -295,7 +295,7 @@ public class VelocityView extends AbstractTemplateView {
*
* @throws Exception if thrown by Velocity
*/
- protected void doRender(final Context context, final HttpServletResponse response)
+ protected void doRender(@Nonnull final Context context, @Nonnull final HttpServletResponse response)
throws Exception {
/*
* TODO: uncomment once we have a commons logging solution
@@ -368,7 +368,7 @@ public class VelocityView extends AbstractTemplateView {
t.merge(context, response.getWriter());
} catch (final MethodInvocationException ex) {
final Throwable cause = ex.getCause();
- throw new NestedServletException(
+ throw new ServletException(
"Method invocation failed during rendering of Velocity view with name '" +
getBeanName() + "': " + ex.getMessage() + "; reference [" + ex.getReferenceName() +
"], method '" + ex.getMethodName() + "'",
diff --git a/shib-velocity/src/main/java/net/shibboleth/shared/velocity/Template.java b/shib-velocity/src/main/java/net/shibboleth/shared/velocity/Template.java
index 4500f3e8..0c585a72 100644
--- a/shib-velocity/src/main/java/net/shibboleth/shared/velocity/Template.java
+++ b/shib-velocity/src/main/java/net/shibboleth/shared/velocity/Template.java
@@ -150,6 +150,7 @@ public final class Template {
throw new VelocityException("The following template is not valid:\n" + trimmedTemplate, e);
}
+ assert templateName != null;
return new Template(engine, templateName, encoding.name());
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list