[java-shib-shared] branch main updated: Null pointer and annotation fixes.

Scott Cantor cantor.2 at osu.edu
Mon Nov 7 15:22:28 UTC 2022


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=54900bef77478f66e7bc536fb595630ffa0169cf

The following commit(s) were added to refs/heads/main by this push:
     new 54900bef Null pointer and annotation fixes.
54900bef is described below

commit 54900bef77478f66e7bc536fb595630ffa0169cf
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Nov 7 10:22:24 2022 -0500

    Null pointer and annotation fixes.
---
 .../spring/config/BooleanToPredicateConverter.java |  5 +-
 .../config/IdentifiableBeanPostProcessor.java      | 11 ++--
 .../spring/config/StringToResourceConverter.java   | 11 ++--
 ...ceholderFileSystemXmlWebApplicationContext.java |  9 ++-
 .../context/DelimiterAwareApplicationContext.java  |  8 ++-
 .../FileSystemXmlWebApplicationContext.java        | 11 +++-
 .../FilesystemGenericApplicationContext.java       |  5 +-
 .../FilesystemGenericWebApplicationContext.java    | 11 ++--
 .../custom/AbstractCustomBeanDefinitionParser.java | 11 ++--
 .../spring/custom/BaseSpringNamespaceHandler.java  |  8 +--
 .../custom/EmbeddedAndSchemaAwareReader.java       | 10 +++-
 ...chemaTypeAwareBeanDefinitionDocumentReader.java | 20 ++++---
 ...chemaTypeAwareBeanDefinitionParserDelegate.java | 19 ++++--
 .../spring/custom/SecondaryNamespaceHandler.java   | 11 +++-
 .../error/ExtendedMappingExceptionResolver.java    | 17 +++---
 .../AbstractSpringExpressionEvaluator.java         | 12 ++--
 .../expression/SpringExpressionBiConsumer.java     | 16 ++---
 .../expression/SpringExpressionBiFunction.java     | 16 ++---
 .../expression/SpringExpressionBiPredicate.java    | 38 ++++++++----
 .../expression/SpringExpressionConsumer.java       |  8 ++-
 .../expression/SpringExpressionFunction.java       |  7 ++-
 .../expression/SpringExpressionPredicate.java      | 28 +++++++--
 .../factory/AbstractComponentAwareFactoryBean.java | 13 ++--
 .../spring/factory/CombiningListFactoryBean.java   |  6 +-
 .../spring/factory/DOMDocumentFactoryBean.java     | 35 ++++++-----
 .../spring/factory/EvaluableScriptFactoryBean.java | 70 +++++++++++++---------
 .../shared/spring/factory/PatternFactoryBean.java  | 17 ++++--
 .../spring/resource/ConditionalResource.java       | 28 +++++----
 .../resource/PreferFileSystemResourceLoader.java   | 10 +++-
 .../shared/spring/resource/ResourceHelper.java     | 14 ++---
 .../resource/RunnableFileSystemResource.java       |  4 +-
 .../util/AnnotationParameterNameDiscoverer.java    |  5 +-
 .../spring/util/ApplicationContextBuilder.java     |  9 +--
 .../shared/spring/util/SpringSupport.java          |  7 +--
 .../config/IdentifiableBeanPostProcessorTest.java  |  7 +++
 .../config/IdentifiedComponentManagerTest.java     |  7 ++-
 .../spring/expression/SpringExpressionTest.java    |  5 +-
 .../config/identifiableBeanPostProcessorTest.xml   |  2 +-
 .../net/shibboleth/shared/resource/Resource.java   |  2 +-
 39 files changed, 341 insertions(+), 192 deletions(-)

diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/BooleanToPredicateConverter.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/BooleanToPredicateConverter.java
index af28f2e7..e7ab28e7 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/config/BooleanToPredicateConverter.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/config/BooleanToPredicateConverter.java
@@ -19,6 +19,9 @@ package net.shibboleth.shared.spring.config;
 
 import java.util.function.Predicate;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import org.springframework.core.convert.converter.Converter;
 
 import com.google.common.base.Predicates;
@@ -29,7 +32,7 @@ import com.google.common.base.Predicates;
 public class BooleanToPredicateConverter implements Converter<Boolean,Predicate<?>> {
 
     /** {@inheritDoc} */
-    public Predicate<?> convert(final Boolean source) {
+    @Nullable public Predicate<?> convert(@Nonnull final Boolean source) {
         return source ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
     }
     
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 9ce258a7..23cb89ea 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
@@ -34,13 +34,14 @@ public class IdentifiableBeanPostProcessor implements BeanPostProcessor {
     @Nonnull private final Logger log = LoggerFactory.getLogger(IdentifiableBeanPostProcessor.class);
 
     /** {@inheritDoc} */
-    public Object postProcessBeforeInitialization(final Object bean, final String beanName) {
+    public Object postProcessBeforeInitialization(@Nonnull final Object bean, @Nonnull final String beanName) {
         if (bean instanceof IdentifiableComponent) {
             final IdentifiableComponent component = (IdentifiableComponent) bean;
-            if (component.getId() == null) {
+            final String id = component.getId();
+            if (id == null) {
                 component.setId(beanName);
             } else if (log.isDebugEnabled()) {
-                if (component.getId().equals(beanName)) {
+                if (id.equals(beanName)) {
                     log.trace("The 'id' property is redundant for bean with 'id' attribute '{}'", beanName);
                 } else {
                     log.trace("The 'id' property is not the same as the 'id' attribute for bean '{}'!='{}'",
@@ -52,8 +53,8 @@ public class IdentifiableBeanPostProcessor implements BeanPostProcessor {
     }
 
     /** {@inheritDoc} */
-    public Object postProcessAfterInitialization(final Object bean, final String beanName) {
+    public Object postProcessAfterInitialization(@Nonnull final Object bean, @Nonnull final String beanName) {
         return bean;
     }
 
-}
+}
\ No newline at end of file
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 c28aedd4..18afc77a 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
@@ -45,9 +45,12 @@ public class StringToResourceConverter implements Converter<String, Resource>, A
     @Nonnull private final Logger log = LoggerFactory.getLogger(StringToResourceConverter.class);
 
     /** {@inheritDoc} */
-    public Resource convert(final String source) {
-        final ResourceLoader loader =
-                applicationContext == null ? new PreferFileSystemResourceLoader() : applicationContext;
+    public Resource convert(@Nonnull final String source) {
+        
+        ResourceLoader loader = applicationContext;
+        if (loader == null) {
+            loader = new PreferFileSystemResourceLoader();
+        }
         final Resource result = ResourceHelper.of(loader.getResource(source));
         
         if (source.endsWith(" ") || log.isDebugEnabled()) {
@@ -64,7 +67,7 @@ public class StringToResourceConverter implements Converter<String, Resource>, A
     }
 
     /** {@inheritDoc} */
-    public void setApplicationContext(final ApplicationContext context) {
+    public void setApplicationContext(@Nullable final ApplicationContext context) {
         applicationContext = context;
     }
 
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/DeferPlaceholderFileSystemXmlWebApplicationContext.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/DeferPlaceholderFileSystemXmlWebApplicationContext.java
index 9657cd70..2f57397d 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/DeferPlaceholderFileSystemXmlWebApplicationContext.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/DeferPlaceholderFileSystemXmlWebApplicationContext.java
@@ -17,6 +17,7 @@
 
 package net.shibboleth.shared.spring.context;
 
+import javax.annotation.Nonnull;
 
 /**
  * An extension of {@link FileSystemXmlWebApplicationContext} that defers property placeholder resolution of config
@@ -39,7 +40,8 @@ public class DeferPlaceholderFileSystemXmlWebApplicationContext extends FileSyst
      * Resolve config locations property placeholders after property sources have been initialized.
      * </p>
      */
-    @Override protected void initPropertySources() {
+    @Override
+    protected void initPropertySources() {
         super.initPropertySources();
         propertySourcesInitialized = true;
         setConfigLocations(getConfigLocations());
@@ -53,11 +55,12 @@ public class DeferPlaceholderFileSystemXmlWebApplicationContext extends FileSyst
      * unchanged.
      * </p>
      */
-    @Override protected String resolvePath(final String path) {
+    @Override
+    @Nonnull protected String resolvePath(@Nonnull final String path) {
         if (propertySourcesInitialized) {
             return super.resolvePath(path);
         }
         return path;
     }
 
-}
+}
\ No newline at end of file
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/DelimiterAwareApplicationContext.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/DelimiterAwareApplicationContext.java
index e166f2f0..15bf39d7 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/DelimiterAwareApplicationContext.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/DelimiterAwareApplicationContext.java
@@ -36,7 +36,8 @@ import net.shibboleth.shared.spring.custom.SchemaTypeAwareXMLBeanDefinitionReade
 public class DelimiterAwareApplicationContext extends DeferPlaceholderFileSystemXmlWebApplicationContext {
 
     /** {@inheritDoc} */
-    @Override public void setConfigLocation(final String location) {
+    @Override
+    public void setConfigLocation(@Nonnull final String location) {
         setConfigLocations(StringUtils.tokenizeToStringArray(location, getDelimiters()));
     }
 
@@ -45,7 +46,8 @@ public class DelimiterAwareApplicationContext extends DeferPlaceholderFileSystem
      * 
      * @return the delimiters
      */
-    @Nonnull protected String getDelimiters() {
+    @Nonnull
+    protected String getDelimiters() {
         return ",;\t\n";
     }
 
@@ -56,7 +58,7 @@ public class DelimiterAwareApplicationContext extends DeferPlaceholderFileSystem
      * the context's ResourceLoader instead of supplanting it.
      */
     @Override
-    protected void loadBeanDefinitions(final DefaultListableBeanFactory beanFactory)
+    protected void loadBeanDefinitions(@Nonnull final DefaultListableBeanFactory beanFactory)
             throws BeansException, IOException {
         // Create a new XmlBeanDefinitionReader for the given BeanFactory.
         final XmlBeanDefinitionReader beanDefinitionReader = new SchemaTypeAwareXMLBeanDefinitionReader(beanFactory);
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FileSystemXmlWebApplicationContext.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FileSystemXmlWebApplicationContext.java
index 1e509924..dc8c18a7 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FileSystemXmlWebApplicationContext.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FileSystemXmlWebApplicationContext.java
@@ -17,6 +17,8 @@
 
 package net.shibboleth.shared.spring.context;
 
+import javax.annotation.Nonnull;
+
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.FileSystemResource;
@@ -49,7 +51,8 @@ public class FileSystemXmlWebApplicationContext extends XmlWebApplicationContext
      * absolute if they are in fact absolute.
      * </p>
      */
-    @Override protected Resource getResourceByPath(final String path) {
+    @Override
+    @Nonnull protected Resource getResourceByPath(@Nonnull final String path) {
         try {
             final Resource r = new FileSystemResource(path);
             if (r.exists()) {
@@ -68,7 +71,8 @@ public class FileSystemXmlWebApplicationContext extends XmlWebApplicationContext
      * Supports wildcard classpath locations prefixed with {@link ResourcePatternResolver#CLASSPATH_ALL_URL_PREFIX}.
      * </p>
      */
-    @Override public Resource getResource(final String location) {
+    @Override
+    @Nonnull public Resource getResource(@Nonnull final String location) {
         Constraint.isNotNull(location, "Location must not be null");
         if (location.startsWith(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX)) {
             return new ClassPathResource(location.substring(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX.length()),
@@ -78,7 +82,8 @@ public class FileSystemXmlWebApplicationContext extends XmlWebApplicationContext
     }
 
     /** {@inheritDoc} */
-    @Override protected DefaultListableBeanFactory createBeanFactory() {
+    @Override
+    @Nonnull protected DefaultListableBeanFactory createBeanFactory() {
         final DefaultListableBeanFactory result = super.createBeanFactory();
         result.setParameterNameDiscoverer(new AnnotationParameterNameDiscoverer());
         return result;
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FilesystemGenericApplicationContext.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FilesystemGenericApplicationContext.java
index c6ef459e..31b706b3 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FilesystemGenericApplicationContext.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FilesystemGenericApplicationContext.java
@@ -20,6 +20,8 @@ package net.shibboleth.shared.spring.context;
 import net.shibboleth.shared.spring.resource.ConditionalResourceResolver;
 import net.shibboleth.shared.spring.util.AnnotationParameterNameDiscoverer;
 
+import javax.annotation.Nonnull;
+
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.GenericApplicationContext;
@@ -82,7 +84,8 @@ public class FilesystemGenericApplicationContext extends GenericApplicationConte
      * absolute if they are in fact absolute.
      * </p>
      */
-    @Override protected Resource getResourceByPath(final String path) {
+    @Override
+    @Nonnull protected Resource getResourceByPath(@Nonnull final String path) {
         try {
             final Resource r = new FileSystemResource(path);
             if (r.exists()) {
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FilesystemGenericWebApplicationContext.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FilesystemGenericWebApplicationContext.java
index 6fae147b..fde8d9ff 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FilesystemGenericWebApplicationContext.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/FilesystemGenericWebApplicationContext.java
@@ -20,6 +20,8 @@ package net.shibboleth.shared.spring.context;
 import net.shibboleth.shared.spring.resource.ConditionalResourceResolver;
 import net.shibboleth.shared.spring.util.AnnotationParameterNameDiscoverer;
 
+import javax.annotation.Nonnull;
+
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.core.io.FileSystemResource;
 import org.springframework.core.io.Resource;
@@ -46,7 +48,7 @@ public class FilesystemGenericWebApplicationContext extends GenericWebApplicatio
      *
      * @param beanFactory bean factory
      */
-    public FilesystemGenericWebApplicationContext(final DefaultListableBeanFactory beanFactory) {
+    public FilesystemGenericWebApplicationContext(@Nonnull final DefaultListableBeanFactory beanFactory) {
         super(beanFactory);
         beanFactory.setParameterNameDiscoverer(new AnnotationParameterNameDiscoverer());
         addProtocolResolver(new ConditionalResourceResolver());
@@ -57,7 +59,7 @@ public class FilesystemGenericWebApplicationContext extends GenericWebApplicatio
      *
      * @param context servlet context
      */
-    public FilesystemGenericWebApplicationContext(final ServletContext context) {
+    public FilesystemGenericWebApplicationContext(@Nonnull final ServletContext context) {
         super(context);
         getDefaultListableBeanFactory().setParameterNameDiscoverer(new AnnotationParameterNameDiscoverer());
         addProtocolResolver(new ConditionalResourceResolver());
@@ -69,7 +71,7 @@ public class FilesystemGenericWebApplicationContext extends GenericWebApplicatio
      * @param beanFactory bean factory
      * @param context servlet context
      */
-    public FilesystemGenericWebApplicationContext(final DefaultListableBeanFactory beanFactory,
+    public FilesystemGenericWebApplicationContext(@Nonnull final DefaultListableBeanFactory beanFactory,
             final ServletContext context) {
         super(beanFactory, context);
         beanFactory.setParameterNameDiscoverer(new AnnotationParameterNameDiscoverer());
@@ -85,7 +87,8 @@ public class FilesystemGenericWebApplicationContext extends GenericWebApplicatio
      * absolute if they are in fact absolute.
      * </p>
      */
-    @Override protected Resource getResourceByPath(final String path) {
+    @Override
+    @Nonnull protected Resource getResourceByPath(@Nonnull final String path) {
         try {
             final Resource r = new FileSystemResource(path);
             if (r.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 be85baff..fb822d19 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
@@ -17,6 +17,8 @@
 
 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;
@@ -32,17 +34,18 @@ import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
 public class AbstractCustomBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
 
     /** Logger. */
-    private final Logger log = LoggerFactory.getLogger(AbstractCustomBeanDefinitionParser.class);
+    @Nonnull private final Logger log = LoggerFactory.getLogger(AbstractCustomBeanDefinitionParser.class);
 
     /** {@inheritDoc}
      * The override is to warn if there is an ID clash within the same context.
      * */
-    protected void registerBeanDefinition(final BeanDefinitionHolder definition,
-                                          final BeanDefinitionRegistry registry) {
+    protected void registerBeanDefinition(@Nonnull final BeanDefinitionHolder definition,
+            @Nonnull final BeanDefinitionRegistry registry) {
         if (registry.containsBeanDefinition(definition.getBeanName())) {
             final String claz = definition.getBeanDefinition().getBeanClassName();
             log.warn("Duplicate Definition '{}' of type '{}'", definition.getBeanName(), claz);
         }
         super.registerBeanDefinition(definition, registry);
     }
-}
+
+}
\ No newline at end of file
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 a81c264f..f4341195 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
@@ -116,8 +116,8 @@ public abstract class BaseSpringNamespaceHandler implements NamespaceHandler {
      * 
      * @return the input bean definition
      */
-    @Override public BeanDefinitionHolder decorate(final Node node, final BeanDefinitionHolder definition, 
-            final ParserContext parserContext) {
+    @Override public BeanDefinitionHolder decorate(@Nonnull final Node node, @Nonnull final BeanDefinitionHolder definition, 
+            @Nonnull final ParserContext parserContext) {
         return definition;
     }
 
@@ -130,7 +130,7 @@ public abstract class BaseSpringNamespaceHandler implements NamespaceHandler {
      * 
      * @return the bean definition created from the given element
      */
-    @Override public BeanDefinition parse(final Element element, final ParserContext parserContext) {
+    @Override public BeanDefinition parse(@Nonnull final Element element, @Nonnull final ParserContext parserContext) {
         return findParserForElement(element).parse(element, parserContext);
     }
 
@@ -187,7 +187,7 @@ 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(final QName elementNameOrType, 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/custom/EmbeddedAndSchemaAwareReader.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/EmbeddedAndSchemaAwareReader.java
index 824c229e..4cf98fd2 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
@@ -19,6 +19,7 @@ package net.shibboleth.shared.spring.custom;
 
 import java.util.List;
 
+import javax.annotation.Nonnull;
 import javax.xml.namespace.QName;
 
 import org.springframework.beans.factory.BeanDefinitionStoreException;
@@ -41,7 +42,7 @@ 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(final Document doc, final XmlReaderContext readerContext)
+    @Override public void registerBeanDefinitions(@Nonnull final Document doc, @Nonnull final XmlReaderContext readerContext)
             throws BeanDefinitionStoreException {
         
         super.registerBeanDefinitions(doc, readerContext);
@@ -52,7 +53,10 @@ public class EmbeddedAndSchemaAwareReader extends SchemaTypeAwareBeanDefinitionD
             return;
         }
         for (final Element elem : beans) {
-            doRegisterBeanDefinitions(elem);
+            if (elem != null) {
+                doRegisterBeanDefinitions(elem);
+            }
         }
     }
-}
+
+}
\ No newline at end of file
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionDocumentReader.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionDocumentReader.java
index 72049620..4f482e65 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionDocumentReader.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/custom/SchemaTypeAwareBeanDefinitionDocumentReader.java
@@ -20,6 +20,9 @@ package net.shibboleth.shared.spring.custom;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
 import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
 import org.springframework.beans.factory.xml.XmlReaderContext;
@@ -45,7 +48,7 @@ public class SchemaTypeAwareBeanDefinitionDocumentReader extends DefaultBeanDefi
      * is directly usable by the installed {@link ResourceLoader}.
      */
     @Override
-    protected void importBeanDefinitionResource(final Element ele) {
+    protected void importBeanDefinitionResource(@Nonnull final Element ele) {
         String location = ele.getAttribute(RESOURCE_ATTRIBUTE);
         if (!StringUtils.hasText(location)) {
             getReaderContext().error("Resource location must not be empty", ele);
@@ -57,16 +60,17 @@ public class SchemaTypeAwareBeanDefinitionDocumentReader extends DefaultBeanDefi
 
         final Set<Resource> actualResources = new LinkedHashSet<>(4);
 
-        final Resource r = getReaderContext().getResourceLoader().getResource(location);
+        final ResourceLoader loader = getReaderContext().getResourceLoader();
+        final Resource r = loader != null ? loader.getResource(location) : null;
         
         boolean exists = false;
         try {
-            exists = r.exists();
+            exists = r != null ? r.exists() : false;
         } catch (final Exception e) {
             // In case exists() throws.
         }
         
-        if (exists) {
+        if (exists && r != null) {
             final int importCount = getReaderContext().getReader().loadBeanDefinitions(r);
             actualResources.add(r);
             if (logger.isTraceEnabled()) {
@@ -81,13 +85,13 @@ public class SchemaTypeAwareBeanDefinitionDocumentReader extends DefaultBeanDefi
     }
 
     /** {@inheritDoc} */
-    @Override protected BeanDefinitionParserDelegate createDelegate(final XmlReaderContext readerContext,
-            final Element root,
-            final BeanDefinitionParserDelegate parentDelegate) {
+    @Override
+    @Nonnull protected BeanDefinitionParserDelegate createDelegate(@Nonnull final XmlReaderContext readerContext,
+            @Nonnull final Element root, @Nullable final BeanDefinitionParserDelegate parentDelegate) {
         final BeanDefinitionParserDelegate delegate =
                 new SchemaTypeAwareBeanDefinitionParserDelegate(readerContext);
         delegate.initDefaults(root, parentDelegate);
         return delegate;
     }
     
-}
+}
\ 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 6fcad1ea..137d134b 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
@@ -17,6 +17,10 @@
 
 package net.shibboleth.shared.spring.custom;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.xml.namespace.QName;
+
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
 import org.springframework.beans.factory.xml.NamespaceHandler;
@@ -44,15 +48,21 @@ public class SchemaTypeAwareBeanDefinitionParserDelegate extends BeanDefinitionP
     }
 
     /** {@inheritDoc} */
-    @Override public BeanDefinition parseCustomElement(final Element element) {
+    @Override
+    public BeanDefinition parseCustomElement(@Nonnull final Element element) {
         return parseCustomElement(element, null);
     }
 
     /** {@inheritDoc} */
-    @Override public BeanDefinition parseCustomElement(final Element element, final BeanDefinition containingBd) {
+    @Override
+    public BeanDefinition parseCustomElement(@Nonnull final Element element,
+            @Nullable final BeanDefinition containingBd) {
         String namespaceUri = element.getNamespaceURI();
         if (DOMTypeSupport.hasXSIType(element)) {
-            namespaceUri = DOMTypeSupport.getXSIType(element).getNamespaceURI();
+            final QName type = DOMTypeSupport.getXSIType(element);
+            if (type != null) {
+                namespaceUri = type.getNamespaceURI();
+            }
         }
 
         final NamespaceHandler handler = getReaderContext().getNamespaceHandlerResolver().resolve(namespaceUri);
@@ -63,4 +73,5 @@ public class SchemaTypeAwareBeanDefinitionParserDelegate extends BeanDefinitionP
 
         return handler.parse(element, new ParserContext(getReaderContext(), this, containingBd));
     }
-}
+
+}
\ No newline at end of file
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 10cab98f..98d2b9ca 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,10 +17,10 @@
 
 package net.shibboleth.shared.spring.custom;
 
+import java.util.Collections;
 import java.util.Map;
 
 import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.xml.namespace.QName;
 
 import org.springframework.beans.factory.xml.BeanDefinitionParser;
@@ -40,7 +40,12 @@ public abstract class SecondaryNamespaceHandler {
      * Stores the {@link BeanDefinitionParser} implementations keyed by the local name of the {@link Element Elements}
      * they handle.
      */
-    @Nullable @NonnullElements private Map<QName, BeanDefinitionParser> parsers; 
+    @Nonnull @NonnullElements private Map<QName, BeanDefinitionParser> parsers; 
+    
+    /** Constructor. */
+    public SecondaryNamespaceHandler() {
+        parsers = Collections.emptyMap();
+    }
     
     /**
      * Initialize the handler, called automatically as part of {@link BaseSpringNamespaceHandler#init()}
@@ -61,7 +66,7 @@ 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(final QName elementNameOrType, 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/ExtendedMappingExceptionResolver.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/error/ExtendedMappingExceptionResolver.java
index 8e14bb7d..2fdfd06e 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/error/ExtendedMappingExceptionResolver.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/error/ExtendedMappingExceptionResolver.java
@@ -55,11 +55,11 @@ public class ExtendedMappingExceptionResolver extends SimpleMappingExceptionReso
     @Nonnull private static final String MODEL_ATTR_ENCODER = "encoder";
     
     /** Function to obtain extensions to view model. */
-    @Nullable private Function<HttpServletRequest,Map<String,Object>> viewModelExtenderFunction;
+    @Nullable private final Function<HttpServletRequest,Map<String,Object>> viewModelExtenderFunction;
     
     /** Constructor. */
     public ExtendedMappingExceptionResolver() {
-        
+        viewModelExtenderFunction = null;
     }
 
     /**
@@ -73,8 +73,8 @@ public class ExtendedMappingExceptionResolver extends SimpleMappingExceptionReso
     
     /** {@inheritDoc} */
     @Override
-    protected ModelAndView doResolveException(final HttpServletRequest request, final HttpServletResponse response,
-            final Object handler, final Exception ex) {
+    protected ModelAndView doResolveException(@Nonnull final HttpServletRequest request,
+            @Nonnull final HttpServletResponse response, @Nullable final Object handler, @Nonnull final Exception ex) {
         
         final ModelAndView view = super.doResolveException(request, response, handler, ex);
         if (view != null) {
@@ -85,8 +85,8 @@ public class ExtendedMappingExceptionResolver extends SimpleMappingExceptionReso
 
     /** {@inheritDoc} */
     @Override
-    protected ModelAndView getModelAndView(final String viewName, final Exception ex,
-            final HttpServletRequest request) {
+    @Nonnull protected ModelAndView getModelAndView(@Nonnull final String viewName, @Nonnull final Exception ex,
+            @Nonnull final HttpServletRequest request) {
         
         LoggerFactory.getLogger(ex.getClass()).error("", ex);
         
@@ -100,8 +100,9 @@ public class ExtendedMappingExceptionResolver extends SimpleMappingExceptionReso
             view.addObject(MODEL_ATTR_SPRINGCONTEXT, context);
         }
         
-        if (viewModelExtenderFunction != null) {
-            final Map<String,Object> exts = viewModelExtenderFunction.apply(request);
+        final Function<HttpServletRequest,Map<String,Object>> local = viewModelExtenderFunction;
+        if (local != null) {
+            final Map<String,Object> exts = local.apply(request);
             if (exts != null) {
                 view.addAllObjects(exts);
             }
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 f1b2c148..dfa130b3 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
@@ -44,7 +44,7 @@ public abstract class AbstractSpringExpressionEvaluator {
     @Nonnull private final Logger log = LoggerFactory.getLogger(AbstractSpringExpressionEvaluator.class);
 
     /** SpEL expression to evaluate. */
-    @Nullable private String springExpression;
+    @Nonnull private final String springExpression;
     
     /** A custom object to inject into the expression context. */
     @Nullable private Object customObject;
@@ -152,13 +152,15 @@ public abstract class AbstractSpringExpressionEvaluator {
                 return null;
             }
             
-            if (null != getOutputType()) {
-                if (!getOutputType().isInstance(output)) {
-                    log.error("Output of type {} was not of type {}", output.getClass(), getOutputType());
+            final Class<?> otype = getOutputType();
+            
+            if (null != otype) {
+                if (!otype.isInstance(output)) {
+                    log.error("Output of type {} was not of type {}", output.getClass(), otype);
                     return returnOnError;
                 }
                 
-                return getOutputType().cast(output);
+                return otype.cast(output);
             }
             
             return output;
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 a0c416cf..e7dccf20 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
@@ -82,13 +82,15 @@ public class SpringExpressionBiConsumer<T,U> extends AbstractSpringExpressionEva
     public void accept(@Nullable final T first, @Nullable final U second) {
         final Pair<Class<T>,Class<U>> types = getInputTypes();
         if (null != types) {
-            if (null != first && !types.getFirst().isInstance(first)) {
-                log.error("Input of type {} was not of type {}", first.getClass(), types.getFirst());
+            final Class<T> intype1 = types.getFirst();
+            final Class<U> intype2 = types.getSecond();
+
+            if (null != first && null != intype1 && !intype1.isInstance(first)) {
+                log.error("Input of type {} was not of type {}", first.getClass(), intype1);
                 return;
             }
-            if (null != second && !types.getSecond().isInstance(second)) {
-                log.error("Input of type {} was not of type {}", second.getClass(),
-                        types.getSecond());
+            if (null != second && null != intype2 && !intype2.isInstance(second)) {
+                log.error("Input of type {} was not of type {}", second.getClass(), intype2);
                 return;
             }
         }
@@ -99,8 +101,8 @@ public class SpringExpressionBiConsumer<T,U> extends AbstractSpringExpressionEva
     /** {@inheritDoc} */
     @Override
     protected void prepareContext(@Nonnull final EvaluationContext context, @Nullable final Object... input) {
-        context.setVariable("input1", input[0]);
-        context.setVariable("input2", input[1]);
+        context.setVariable("input1", input != null ? input[0] : null);
+        context.setVariable("input2", input != null ? input[1] : null);
     }
     
 }
\ No newline at end of file
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 308ee4d4..84781507 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
@@ -102,13 +102,15 @@ public class SpringExpressionBiFunction<T,U,V> extends AbstractSpringExpressionE
     @Nullable public V apply(@Nullable final T first, @Nullable final U second) {
         final Pair<Class<T>,Class<U>> types = getInputTypes();
         if (null != types) {
-            if (null != first && !types.getFirst().isInstance(first)) {
-                log.error("Input of type {} was not of type {}", first.getClass(), types.getFirst());
+            final Class<T> intype1 = types.getFirst();
+            final Class<U> intype2 = types.getSecond();
+
+            if (null != first && null != intype1 && !intype1.isInstance(first)) {
+                log.error("Input of type {} was not of type {}", first.getClass(), intype1);
                 return (V) getReturnOnError();
             }
-            if (null != second && !types.getSecond().isInstance(second)) {
-                log.error("Input of type {} was not of type {}", second.getClass(),
-                        types.getSecond());
+            if (null != second && null != intype2 && !intype2.isInstance(second)) {
+                log.error("Input of type {} was not of type {}", second.getClass(), intype2);
                 return (V) getReturnOnError();
             }
         }
@@ -119,8 +121,8 @@ public class SpringExpressionBiFunction<T,U,V> extends AbstractSpringExpressionE
     /** {@inheritDoc} */
     @Override
     protected void prepareContext(@Nonnull final EvaluationContext context, @Nullable final Object... input) {
-        context.setVariable("input1", input[0]);
-        context.setVariable("input2", input[1]);
+        context.setVariable("input1", input != null ? input[0] : null);
+        context.setVariable("input2", input != null ? input[1] : null);
     }
     
 }
\ No newline at end of file
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 9a243865..54783372 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
@@ -93,26 +93,44 @@ public class SpringExpressionBiPredicate<T,U> extends AbstractSpringExpressionEv
     public boolean test(@Nullable final T first, @Nullable final U second) {
         final Pair<Class<T>,Class<U>> types = getInputTypes();
         if (null != types) {
-            if (null != first && !types.getFirst().isInstance(first)) {
-                log.error("Input of type {} was not of type {}", first.getClass(), types.getFirst());
-                return (boolean) getReturnOnError();
+            final Class<T> intype1 = types.getFirst();
+            final Class<U> intype2 = types.getSecond();
+            
+            if (null != first && null != intype1 && !intype1.isInstance(first)) {
+                log.error("Input of type {} was not of type {}", first.getClass(), intype1);
+                return (boolean) returnError();
             }
-            if (null != second && !types.getSecond().isInstance(second)) {
-                log.error("Input of type {} was not of type {}", second.getClass(),
-                        types.getSecond());
-                return (boolean) getReturnOnError();
+            if (null != second && null != intype2 && !intype2.isInstance(second)) {
+                log.error("Input of type {} was not of type {}", second.getClass(), intype2);
+                return (boolean) returnError();
             }
         }
 
         final Object result = evaluate(first, second);
-        return (boolean) (result != null ? result : getReturnOnError());
+        return (boolean) (result != null ? result : returnError());
+    }
+
+    /**
+     * Helper function to sanity check return-on-error object.
+     * 
+     * @return a boolean-valued error fallback
+     * 
+     * @throws ClassCastException if the installed fallback is null or non-Boolean
+     */
+    private boolean returnError() throws ClassCastException {
+        final Object ret = getReturnOnError();
+        if (ret instanceof Boolean) {
+            return (boolean) ret;
+        }
+        
+        throw new ClassCastException("Unable to cast return value to a boolean");
     }
 
     /** {@inheritDoc} */
     @Override
     protected void prepareContext(@Nonnull final EvaluationContext context, @Nullable final Object... input) {
-        context.setVariable("input1", input[0]);
-        context.setVariable("input2", input[1]);
+        context.setVariable("input1", input != null ? input[0] : null);
+        context.setVariable("input2", input != null ? input[1] : null);
     }
     
 }
\ No newline at end of file
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 87f4b3c1..4d6e5f64 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
@@ -78,8 +78,10 @@ public class SpringExpressionConsumer<T> extends AbstractSpringExpressionEvaluat
     
     /** {@inheritDoc} */
     public void accept(@Nullable final T input) {
-        if (null != getInputType() && null != input && !getInputType().isInstance(input)) {
-            log.error("Input of type {} was not of type {}", input.getClass(), getInputType());
+        final Class<T> itype = getInputType();
+        
+        if (null != itype && null != input && !itype.isInstance(input)) {
+            log.error("Input of type {} was not of type {}", input.getClass(), itype);
         } else {
             evaluate(input);
         }
@@ -88,7 +90,7 @@ public class SpringExpressionConsumer<T> extends AbstractSpringExpressionEvaluat
     /** {@inheritDoc} */
     @Override
     protected void prepareContext(@Nonnull final EvaluationContext context, @Nullable final Object... input) {
-        context.setVariable("input", input[0]);
+        context.setVariable("input", input != null ? input[0] : null);
     }
     
 }
\ No newline at end of file
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 efbba424..5a474b8c 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
@@ -96,10 +96,11 @@ public class SpringExpressionFunction<T,U> extends AbstractSpringExpressionEvalu
     public U apply(@Nullable final T input) {
         
         // Try outside the try so as to preserve derived semantics
-        if (null != input && null != getInputType() && !getInputType().isInstance(input)) {
+        final Class<T> itype = getInputType();
+        if (null != itype && null != input && !itype.isInstance(input)) {
             log.error("Input was type {} which is not an instance of {}",  input.getClass(), getInputType());
             throw new ClassCastException("Input was type " + input.getClass() + " which is not an instance of "
-                    + getInputType());
+                    + itype);
         }
 
         return (U) evaluate(input);
@@ -108,7 +109,7 @@ public class SpringExpressionFunction<T,U> extends AbstractSpringExpressionEvalu
     /** {@inheritDoc} */
     @Override
     protected void prepareContext(@Nonnull final EvaluationContext context, @Nullable final Object... input) {
-        context.setVariable("input", input[0]);
+        context.setVariable("input", input != null ? input[0] : null);
     }
     
 }
\ No newline at end of file
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 8b22c730..8de8267b 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
@@ -87,19 +87,37 @@ public class SpringExpressionPredicate<T> extends AbstractSpringExpressionEvalua
 
     /** {@inheritDoc} */
     public boolean test(@Nullable final T input) {
-        if (null != getInputType() && null != input && !getInputType().isInstance(input)) {
-            log.error("Input of type {} was not of type {}", input.getClass(), getInputType());
-            return (boolean) getReturnOnError();
+        
+        final Class<T> itype = getInputType();
+        if (null != itype && null != input && !itype.isInstance(input)) {
+            log.error("Input of type {} was not of type {}", input.getClass(), itype);
+            return returnError();
         }
 
         final Object result = evaluate(input);
-        return (boolean) (result != null ? result : getReturnOnError());
+        return (boolean) (result != null ? result : returnError());
     }
 
+    /**
+     * Helper function to sanity check return-on-error object.
+     * 
+     * @return a boolean-valued error fallback
+     * 
+     * @throws ClassCastException if the installed fallback is null or non-Boolean
+     */
+    private boolean returnError() throws ClassCastException {
+        final Object ret = getReturnOnError();
+        if (ret instanceof Boolean) {
+            return (boolean) ret;
+        }
+        
+        throw new ClassCastException("Unable to cast return value to a boolean");
+    }
+    
     /** {@inheritDoc} */
     @Override
     protected void prepareContext(@Nonnull final EvaluationContext context, @Nullable final Object... input) {
-        context.setVariable("input", input[0]);
+        context.setVariable("input", input != null ? input[0] : null);
     }
     
 }
\ No newline at end of file
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/AbstractComponentAwareFactoryBean.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/AbstractComponentAwareFactoryBean.java
index 8cb0c407..b7c59f07 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/AbstractComponentAwareFactoryBean.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/AbstractComponentAwareFactoryBean.java
@@ -17,6 +17,9 @@
 
 package net.shibboleth.shared.spring.factory;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.BeanCreationException;
 import org.springframework.beans.factory.config.AbstractFactoryBean;
@@ -32,7 +35,7 @@ import net.shibboleth.shared.component.InitializableComponent;
 public abstract class AbstractComponentAwareFactoryBean<T> extends AbstractFactoryBean<T> {
 
     /** {@inheritDoc}. Call our destroy method if aposite. */
-    @Override protected void destroyInstance(final T instance) throws Exception {
+    @Override protected void destroyInstance(@Nullable final T instance) throws Exception {
         super.destroyInstance(instance);
         if (instance instanceof DestructableComponent) {
             ((DestructableComponent) instance).destroy();
@@ -42,7 +45,8 @@ public abstract class AbstractComponentAwareFactoryBean<T> extends AbstractFacto
     /**
      * Call the parent class to create the object, then initialize it aposite. {@inheritDoc}.
      */
-    @Override protected final T createInstance() throws Exception {
+    @Override
+    @Nonnull protected final T createInstance() throws Exception {
         if (!isSingleton()) {
             LoggerFactory.getLogger(AbstractComponentAwareFactoryBean.class).error(
                     "Configuration error: {} should not be used to create prototype beans."
@@ -62,5 +66,6 @@ public abstract class AbstractComponentAwareFactoryBean<T> extends AbstractFacto
      * @return the bean.
      * @throws Exception if needed.
      */
-    protected abstract T doCreateInstance() throws Exception;
-}
+    @Nonnull protected abstract T doCreateInstance() throws Exception;
+
+}
\ No newline at end of file
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/CombiningListFactoryBean.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/CombiningListFactoryBean.java
index 50f165da..aafb35be 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/CombiningListFactoryBean.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/CombiningListFactoryBean.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import org.springframework.beans.factory.BeanCreationException;
@@ -38,7 +39,7 @@ public class CombiningListFactoryBean extends ListFactoryBean {
     @Nullable private List<?> secondList = Collections.emptyList();
  
     /** {@inheritDoc} */
-    @Override public void setSourceList(final List<?> sourceList) {
+    @Override public void setSourceList(@Nonnull final List<?> sourceList) {
         throw new BeanCreationException("Call setFirstList() amnd setSecondList()");
     }
 
@@ -71,7 +72,8 @@ public class CombiningListFactoryBean extends ListFactoryBean {
     }
     
     /** {@inheritDoc} */
-    @Override protected List<Object> createInstance() {
+    @Override
+    @Nonnull protected List<Object> createInstance() {
         final ArrayList<Object> combined = new ArrayList<>();
         if (firstList != null) {
             combined.addAll(firstList);
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBean.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBean.java
index 94de3518..c6ee8b59 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBean.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/DOMDocumentFactoryBean.java
@@ -47,7 +47,7 @@ public class DOMDocumentFactoryBean implements FactoryBean<Document> {
      *
      * @param domResource resource, never null
      */
-    public void setResource(@Nonnull final Resource domResource) {
+    public synchronized void setResource(@Nonnull final Resource domResource) {
         resource = Constraint.isNotNull(domResource, "resource cannot be null");
     }
 
@@ -56,38 +56,41 @@ public class DOMDocumentFactoryBean implements FactoryBean<Document> {
      *
      * @param pool parser pool, never null.
      */
-    public void setParserPool(@Nonnull final ParserPool pool) {
+    public synchronized void setParserPool(@Nonnull final ParserPool pool) {
         parserPool = Constraint.isNotNull(pool, "ParserPool cannot be null");
     }
 
     /** {@inheritDoc} */
-    @Override @Nonnull public synchronized Document getObject() throws Exception {
+    @Override
+    @Nonnull public synchronized Document getObject() throws Exception {
         
         if (document != null) {
             return document;
         }
-
-        if (resource == null){
-            throw new BeanCreationException("Document resource must be provided in order to use this factory.");
-        }
         
-        if (parserPool == null){
-            throw new BeanCreationException("ParserPool must be provided in order to use this factory.");
-        }
-        
-        try (InputStream is = resource.getInputStream()) {
-            document = parserPool.parse(is);
-            return document;
+        if (resource != null) {
+            try (final InputStream is = resource.getInputStream()) {
+                if (parserPool != null) {
+                    document = parserPool.parse(is);
+                    return document;
+                } else {
+                    throw new BeanCreationException("ParserPool must be provided in order to use this factory.");
+                }
+            }
+        } else {
+            throw new BeanCreationException("Document resource must be provided in order to use this factory.");
         }
     }
 
     /** {@inheritDoc} */
-    @Override @Nonnull public Class<?> getObjectType() {
+    @Override
+    @Nonnull public Class<?> getObjectType() {
         return Document.class;
     }
 
     /** {@inheritDoc} */
-    @Override public boolean isSingleton() {
+    @Override
+    public boolean isSingleton() {
         return true;
     }
 }
\ No newline at end of file
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 5101580a..a8398a83 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
@@ -19,6 +19,9 @@ package net.shibboleth.shared.spring.factory;
 
 import java.io.InputStream;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import net.shibboleth.shared.primitive.StringSupport;
 import net.shibboleth.shared.scripting.EvaluableScript;
 
@@ -33,26 +36,26 @@ import org.springframework.core.io.Resource;
 public class EvaluableScriptFactoryBean extends AbstractComponentAwareFactoryBean<EvaluableScript> {
 
     /** log. */
-    private final Logger log = LoggerFactory.getLogger(EvaluableScript.class);
+    @Nonnull private final Logger log = LoggerFactory.getLogger(EvaluableScript.class);
 
     /** The resource which locates the script. */
-    private Resource resource;
+    @Nullable private Resource resource;
 
     /** The script. */
-    private String script;
+    @Nullable private String script;
 
     /** The JSR223 engine name. */
-    private String engineName;
+    @Nullable private String engineName;
 
     /** The source Id. */
-    private String sourceId;
+    @Nullable private String sourceId;
 
     /**
      * Get the resource which locates the script.
      * 
      * @return Returns the resource.
      */
-    public Resource getResource() {
+    @Nullable public Resource getResource() {
         return resource;
     }
 
@@ -61,7 +64,7 @@ public class EvaluableScriptFactoryBean extends AbstractComponentAwareFactoryBea
      * 
      * @param what the resource to set.
      */
-    public void setResource(final Resource what) {
+    public void setResource(@Nullable final Resource what) {
         resource = what;
     }
 
@@ -70,7 +73,7 @@ public class EvaluableScriptFactoryBean extends AbstractComponentAwareFactoryBea
      * 
      * @return Returns the script as text.
      */
-    public String getScript() {
+    @Nullable public String getScript() {
         return script;
     }
 
@@ -79,7 +82,7 @@ public class EvaluableScriptFactoryBean extends AbstractComponentAwareFactoryBea
      * 
      * @param what the script to set.
      */
-    public void setScript(final String what) {
+    public void setScript(@Nullable final String what) {
         script = what;
     }
 
@@ -88,7 +91,7 @@ public class EvaluableScriptFactoryBean extends AbstractComponentAwareFactoryBea
      * 
      * @return Returns the sourceID.
      */
-    public String getSourceId() {
+    @Nullable public String getSourceId() {
         return sourceId;
     }
 
@@ -97,7 +100,7 @@ public class EvaluableScriptFactoryBean extends AbstractComponentAwareFactoryBea
      * 
      * @param what the Id to set.
      */
-    public void setSourceId(final String what) {
+    public void setSourceId(@Nullable final String what) {
         sourceId = what;
     }
 
@@ -106,7 +109,7 @@ public class EvaluableScriptFactoryBean extends AbstractComponentAwareFactoryBea
      * 
      * @return Returns the engine name.
      */
-    public String getEngineName() {
+    @Nullable public String getEngineName() {
         return engineName;
     }
 
@@ -115,17 +118,19 @@ public class EvaluableScriptFactoryBean extends AbstractComponentAwareFactoryBea
      * 
      * @param what the engine name to set.
      */
-    public void setEngineName(final String what) {
+    public void setEngineName(@Nullable final String what) {
         engineName = what;
     }
 
     /** {@inheritDoc} */
-    @Override public Class<?> getObjectType() {
+    @Override
+    @Nonnull public Class<?> getObjectType() {
         return EvaluableScript.class;
     }
 
     /** {@inheritDoc} */
-    @Override protected EvaluableScript doCreateInstance() throws Exception {
+    @Override
+    @Nonnull protected EvaluableScript doCreateInstance() throws Exception {
 
         if (null == script && null == resource) {
             log.error("{} A script or a resource must be supplied", sourceId);
@@ -136,24 +141,33 @@ public class EvaluableScriptFactoryBean extends AbstractComponentAwareFactoryBea
             throw new BeanCreationException("Only one of script or resource should be supplied");
         }
 
+        final String toExecute;
+        
         if (null != resource) {
-            try (InputStream is = resource.getInputStream()) {
-                script = StringSupport.inputStreamToString(is, null);
+            try (final InputStream is = resource.getInputStream()) {
+                toExecute = StringSupport.inputStreamToString(is, null);
             }
+        } else {
+            toExecute = script;
         }
-        log.debug("{} Language: {} Script: {} ", sourceId, engineName==null ? "<default>" : engineName, script);
 
-        final EvaluableScript evaluableScript = new EvaluableScript();
-        evaluableScript.setScript(script);
+        log.debug("{} Language: {} Script: {} ", sourceId, engineName==null ? "<default>" : engineName, script);
 
-        if (engineName != null) {
-            evaluableScript.setEngineName(engineName);
+        if (toExecute != null) {
+            final EvaluableScript evaluableScript = new EvaluableScript();
+            evaluableScript.setScript(toExecute);
+    
+            if (engineName != null) {
+                evaluableScript.setEngineName(engineName);
+            }
+            //
+            // Initialize for compatibility reasons
+            //
+            evaluableScript.initialize();
+            return evaluableScript;
         }
-        //
-        // Initialize for compatibility reasons
-        //
-        evaluableScript.initialize();
-        return evaluableScript;
+        
+        throw new BeanCreationException("Unable to load script");
     }
 
-}
+}
\ No newline at end of file
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/PatternFactoryBean.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/PatternFactoryBean.java
index ac1d7fdf..cd9f6dc7 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/PatternFactoryBean.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/factory/PatternFactoryBean.java
@@ -22,6 +22,8 @@ import java.util.regex.Pattern;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import org.springframework.beans.factory.BeanCreationException;
+
 import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.primitive.StringSupport;
 
@@ -37,7 +39,8 @@ public class PatternFactoryBean extends AbstractComponentAwareFactoryBean<Patter
     @Nullable private String regexp;
 
     /** {@inheritDoc} */
-    @Override public Class<?> getObjectType() {
+    @Override
+    @Nonnull public Class<?> getObjectType() {
         return Pattern.class;
     }
 
@@ -46,7 +49,7 @@ public class PatternFactoryBean extends AbstractComponentAwareFactoryBean<Patter
      * 
      * @return Returns the caseSensitive.
      */
-    public String getCaseSensitive() {
+    @Nullable public String getCaseSensitive() {
         return caseSensitive;
     }
 
@@ -56,7 +59,6 @@ public class PatternFactoryBean extends AbstractComponentAwareFactoryBean<Patter
      * @param what The value to set.
      */
     public void setCaseSensitive(@Nullable final String what) {
-        Constraint.isNotNull(what, "caseSensitive cannot be null");
         caseSensitive = what;
     }
 
@@ -74,13 +76,16 @@ public class PatternFactoryBean extends AbstractComponentAwareFactoryBean<Patter
      * 
      * @param what what to set.
      */
-    public void setRegexp(@Nonnull final String what) {
+    public void setRegexp(@Nullable final String what) {
         regexp = what;
     }
 
     /** {@inheritDoc} */
-    @Override protected Pattern doCreateInstance() throws Exception {
-        Constraint.isNotNull(regexp, "Regular expression cannot be null");
+    @Override
+    @Nonnull protected Pattern doCreateInstance() throws Exception {
+        if (regexp == null) {
+            throw new BeanCreationException("Regular expression cannot be null");
+        }
         
         final Boolean isCaseSensitive;
         if (caseSensitive != null) {
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 bdad67a0..1278d7b3 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
@@ -114,10 +114,10 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
     }
 
     /** {@inheritDoc} */
-    public net.shibboleth.shared.resource.Resource createRelativeResource(final String relativePath)
+    @Nonnull public net.shibboleth.shared.resource.Resource createRelativeResource(@Nonnull final String relativePath)
             throws IOException {
-        
         checkComponentActive();
+        
         final Resource relative = wrappedResource.createRelative(relativePath);
         if (relative instanceof net.shibboleth.shared.resource.Resource) {
             return (net.shibboleth.shared.resource.Resource) relative;
@@ -127,7 +127,7 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
     }
 
     /** {@inheritDoc} */
-    public void setBeanName(final String name) {
+    public void setBeanName(@Nonnull final String name) {
         setId(name);
     }
 
@@ -160,7 +160,7 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
     }
 
     /** {@inheritDoc} */
-    public URL getURL() throws IOException {
+    @Nonnull public URL getURL() throws IOException {
         checkComponentActive();
         
         try {
@@ -169,12 +169,14 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
             if (log.isDebugEnabled()) {
                 log.debug("{} getURL failed on wrapped resource", getLogPrefix(), e);
             }
-            return null;
+            
+            // TODO: this is strictly correct but may cause issues
+            throw e;
         }
     }
 
     /** {@inheritDoc} */
-    public URI getURI() throws IOException {
+    @Nonnull public URI getURI() throws IOException {
         checkComponentActive();
         
         try {
@@ -183,12 +185,14 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
             if (log.isDebugEnabled()) {
                 log.debug("{} getURI failed on wrapped resource", getLogPrefix(), e);
             }
-            return null;
+            
+            // TODO: this is strictly correct but may cause issues
+            throw e;
         }
     }
 
     /** {@inheritDoc} */
-    public File getFile() throws IOException {
+    @Nonnull public File getFile() throws IOException {
         checkComponentActive();
         
         try {
@@ -197,7 +201,9 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
             if (log.isDebugEnabled()) {
                 log.debug("{} getFile failed on wrapped resource", getLogPrefix(), e);
             }
-            return null;
+            
+            // TODO: this is strictly correct but may cause issues
+            throw e;
         }
     }
 
@@ -230,7 +236,7 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
     }
 
     /** {@inheritDoc} */
-    public Resource createRelative(final String relativePath) throws IOException {
+    @Nonnull public Resource createRelative(@Nonnull final String relativePath) throws IOException {
         checkComponentActive();
         
         return wrappedResource.createRelative(relativePath);
@@ -244,7 +250,7 @@ public class ConditionalResource extends AbstractIdentifiedInitializableComponen
     }
 
     /** {@inheritDoc} */
-    public String getDescription() {
+    @Nonnull public String getDescription() {
         checkComponentActive();
         
         return wrappedResource.getDescription();
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/PreferFileSystemResourceLoader.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/PreferFileSystemResourceLoader.java
index 929ca919..d41c469f 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/PreferFileSystemResourceLoader.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/PreferFileSystemResourceLoader.java
@@ -17,6 +17,8 @@
 
 package net.shibboleth.shared.spring.resource;
 
+import javax.annotation.Nonnull;
+
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.DefaultResourceLoader;
 import org.springframework.core.io.FileSystemResource;
@@ -40,7 +42,8 @@ public class PreferFileSystemResourceLoader extends DefaultResourceLoader {
      * absolute if they are in fact absolute.
      * </p>
      */
-    @Override protected Resource getResourceByPath(final String path) {
+    @Override
+    @Nonnull protected Resource getResourceByPath(@Nonnull final String path) {
         final Resource r = new FileSystemResource(path);
         if (r.exists()) {
             return r;
@@ -56,7 +59,8 @@ public class PreferFileSystemResourceLoader extends DefaultResourceLoader {
      * Supports wildcard classpath locations prefixed with {@link ResourcePatternResolver#CLASSPATH_ALL_URL_PREFIX}.
      * </p>
      */
-    @Override public Resource getResource(final String location) {
+    @Override
+    @Nonnull public Resource getResource(@Nonnull final String location) {
         Constraint.isNotNull(location, "Location must not be null");
         if (location.startsWith(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX)) {
             return new ClassPathResource(location.substring(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX.length()),
@@ -65,4 +69,4 @@ public class PreferFileSystemResourceLoader extends DefaultResourceLoader {
         return super.getResource(location);
     }
 
-}
+}
\ No newline at end of file
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ResourceHelper.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ResourceHelper.java
index 6c4beb04..b52d2cb3 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ResourceHelper.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/resource/ResourceHelper.java
@@ -58,7 +58,7 @@ public final class ResourceHelper implements net.shibboleth.shared.resource.Reso
      * @return a {@link net.shibboleth.shared.resource.Resource} which reflects what the Spring one does
      */
     @Nonnull public static net.shibboleth.shared.resource.Resource
-                 of(@ParameterName(name="springResource") final Resource springResource) {
+                 of(@Nonnull @ParameterName(name="springResource") final Resource springResource) {
         if (springResource instanceof net.shibboleth.shared.resource.Resource) {
             return (net.shibboleth.shared.resource.Resource) springResource;
         }
@@ -86,17 +86,17 @@ public final class ResourceHelper implements net.shibboleth.shared.resource.Reso
     }
 
     /** {@inheritDoc} */
-    public URL getURL() throws IOException {
+    @Nonnull public URL getURL() throws IOException {
         return springResource.getURL();
     }
 
     /** {@inheritDoc} */
-    public URI getURI() throws IOException {
+    @Nonnull public URI getURI() throws IOException {
         return springResource.getURI();
     }
 
     /** {@inheritDoc} */
-    public File getFile() throws IOException {
+    @Nonnull public File getFile() throws IOException {
         return springResource.getFile();
     }
 
@@ -111,8 +111,8 @@ public final class ResourceHelper implements net.shibboleth.shared.resource.Reso
     }
 
     /** {@inheritDoc} */
-    public net.shibboleth.shared.resource.Resource
-            createRelativeResource(final String relativePath) throws IOException {
+    @Nonnull public net.shibboleth.shared.resource.Resource
+            createRelativeResource(@Nonnull final String relativePath) throws IOException {
 
         return of(springResource.createRelative(relativePath));
     }
@@ -123,7 +123,7 @@ public final class ResourceHelper implements net.shibboleth.shared.resource.Reso
     }
 
     /** {@inheritDoc} */
-    public String getDescription() {
+    @Nonnull public String getDescription() {
         return springResource.getDescription();
     }
 
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 b6a9f066..bd0b3fc5 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
@@ -88,7 +88,9 @@ public class RunnableFileSystemResource extends FileSystemResource
     }
 
     /** {@inheritDoc} */
-    @Override public RunnableFileSystemResource createRelativeResource(final String relativePath) throws IOException {
+    @Override
+    @Nonnull public RunnableFileSystemResource createRelativeResource(@Nonnull final String relativePath)
+            throws IOException {
         return new RunnableFileSystemResource(super.createRelative(relativePath).getFile(), theRunnable);
     }
 
diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/util/AnnotationParameterNameDiscoverer.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/util/AnnotationParameterNameDiscoverer.java
index 6a49c030..fd0b5b55 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/util/AnnotationParameterNameDiscoverer.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/util/AnnotationParameterNameDiscoverer.java
@@ -21,6 +21,7 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import org.slf4j.Logger;
@@ -42,7 +43,7 @@ public class AnnotationParameterNameDiscoverer extends DefaultParameterNameDisco
     private final Logger log = LoggerFactory.getLogger(AnnotationParameterNameDiscoverer.class);
 
     /** {@inheritDoc} */
-    @Override @Nullable public String[] getParameterNames(final Method method) {
+    @Override @Nullable public String[] getParameterNames(@Nonnull final Method method) {
 
         return super.getParameterNames(method);
     }
@@ -66,7 +67,7 @@ public class AnnotationParameterNameDiscoverer extends DefaultParameterNameDisco
      *
      * <p>If we cannot do anything pass to the default discoverer.</p>
      */
-    @Override public String[] getParameterNames(final Constructor<?> ctor) {
+    @Override public String[] getParameterNames(@Nonnull final Constructor<?> ctor) {
 
         final Annotation[][] annotationsArray = ctor.getParameterAnnotations();
         if (annotationsArray.length == 0) {
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 ae37d38d..db62a826 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
@@ -368,7 +368,8 @@ public class ApplicationContextBuilder {
         }
         
         if (beanProfiles != null) {
-            context.getEnvironment().setActiveProfiles(beanProfiles.toArray(new String[0]));
+            final String[] profiles = beanProfiles.toArray(new String[0]);
+            context.getEnvironment().setActiveProfiles(profiles);
         }
         
         if (propertySources != null) {
@@ -384,7 +385,7 @@ public class ApplicationContextBuilder {
         final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
                 new SchemaTypeAwareXMLBeanDefinitionReader(context);
         
-        if (configurationSources != null && !configurationSources.isEmpty()) {
+        if (configurationSources != null) {
             configurationSources.stream().forEachOrdered(
                     s -> {
                         try {
@@ -402,7 +403,7 @@ public class ApplicationContextBuilder {
                 );
         }
 
-        if (configurationResources != null && !configurationResources.isEmpty()) {
+        if (configurationResources != null) {
             final List<Resource> filtered = configurationResources.stream()
                 .filter(r -> {
                     if (r.exists()) {
@@ -413,7 +414,7 @@ public class ApplicationContextBuilder {
                 })
                 .collect(Collectors.toUnmodifiableList());
             if (!filtered.isEmpty()) {
-                beanDefinitionReader.loadBeanDefinitions(filtered.toArray(new Resource[] {}));
+                beanDefinitionReader.loadBeanDefinitions(filtered.toArray(new Resource[0]));
             }
         }
         
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 6ff3e385..d2b33e0a 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
@@ -160,8 +160,7 @@ public final class SpringSupport {
      * @return the bean definition, <em>unless this is for a parent scoped bean</em>
      */
     @Nullable public static BeanDefinition parseCustomElement(@Nullable final Element element, 
-            @Nonnull final ParserContext parserContext,
-            @Nullable final BeanDefinitionBuilder parentBuilder,
+            @Nonnull final ParserContext parserContext, @Nullable final BeanDefinitionBuilder parentBuilder,
             final boolean lazyInit) {
         if (element == null) {
             return null;
@@ -174,7 +173,7 @@ public final class SpringSupport {
         }
 
         final BeanDefinition def = parserContext.getDelegate().parseCustomElement(element, containingBd);
-        if (lazyInit) {
+        if (lazyInit && def != null) {
             def.setLazyInit(true);
         }
         if (null == parentBuilder) {
@@ -206,7 +205,7 @@ public final class SpringSupport {
      * @param registry the registry to populate
      */
     public static void
-            parseNativeElement(@Nonnull final Element springBeans, @Nullable final BeanDefinitionRegistry registry) {
+            parseNativeElement(@Nonnull final Element springBeans, @Nonnull final BeanDefinitionRegistry registry) {
         final XmlBeanDefinitionReader definitionReader = new XmlBeanDefinitionReader(registry);
         definitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
         definitionReader.setNamespaceAware(true);
diff --git a/shib-spring/src/test/java/net/shibboleth/shared/spring/config/IdentifiableBeanPostProcessorTest.java b/shib-spring/src/test/java/net/shibboleth/shared/spring/config/IdentifiableBeanPostProcessorTest.java
index 2f699087..15063b24 100644
--- a/shib-spring/src/test/java/net/shibboleth/shared/spring/config/IdentifiableBeanPostProcessorTest.java
+++ b/shib-spring/src/test/java/net/shibboleth/shared/spring/config/IdentifiableBeanPostProcessorTest.java
@@ -39,35 +39,42 @@ public class IdentifiableBeanPostProcessorTest extends AbstractTestNGSpringConte
 
     @Test(expectedExceptions = {ComponentInitializationException.class, BeanCreationException.class,}) public void
             defaultedIdentified() {
+        assert(applicationContext != null);
         applicationContext.getBean("IdentifiedBean");
     }
 
     @Test public void defaultedIdentifiable() {
+        assert(applicationContext != null);
         IdentifiedComponent bean = applicationContext.getBean("IdentifiableBean", Identifiable.class);
         Assert.assertEquals(bean.getId(), "IdentifiableBean");
     }
 
     @Test public void nonDefaultedIdentified() {
+        assert(applicationContext != null);
         IdentifiedComponent bean = applicationContext.getBean("NonDefaultIdentifiedBean", Identified.class);
         Assert.assertEquals(bean.getId(), "NameForAnIdentifiedBean");
     }
 
     @Test public void nonDefaultedIdentifiable() {
+        assert(applicationContext != null);
         IdentifiedComponent bean = applicationContext.getBean("NonDefaultIdentifiableBean", Identifiable.class);
         Assert.assertEquals(bean.getId(), "NameForAnIdentifiableBean");
     }
 
     @Test public void TautologousTest() {
+        assert(applicationContext != null);
         IdentifiedComponent bean = applicationContext.getBean("TautologousName", Identifiable.class);
         Assert.assertEquals(bean.getId(), "TautologousName");
     }
 
     @Test public void testSingleton() {
+        assert(applicationContext != null);
         IdentifiedComponent bean = applicationContext.getBean("SingletonIdentifiableBean", Identifiable.class);
         Assert.assertEquals(bean.getId(), "SingletonIdentifiableBean");
     }
 
     @Test public void testNonDefaultSingleton() {
+        assert(applicationContext != null);
         IdentifiedComponent bean = applicationContext.getBean("NonDefaultSingletonIdentifiableBean", Identifiable.class);
         Assert.assertEquals(bean.getId(), "NameForNonDefaultSingletonIdentifiableBean");
     }
diff --git a/shib-spring/src/test/java/net/shibboleth/shared/spring/config/IdentifiedComponentManagerTest.java b/shib-spring/src/test/java/net/shibboleth/shared/spring/config/IdentifiedComponentManagerTest.java
index a05f49c1..7dd43e5d 100644
--- a/shib-spring/src/test/java/net/shibboleth/shared/spring/config/IdentifiedComponentManagerTest.java
+++ b/shib-spring/src/test/java/net/shibboleth/shared/spring/config/IdentifiedComponentManagerTest.java
@@ -19,6 +19,7 @@ package net.shibboleth.shared.spring.config;
 
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Objects;
 
 import javax.annotation.Nonnull;
 
@@ -132,7 +133,9 @@ public class IdentifiedComponentManagerTest {
         
         /** {@inheritDoc} */
         @Override public int hashCode() {
-            return getId().hashCode();
+            final String id = getId();
+            assert(id != null);
+            return id.hashCode();
         }
 
         /** {@inheritDoc} */
@@ -146,7 +149,7 @@ public class IdentifiedComponentManagerTest {
             }
 
             if (obj instanceof MockComponent) {
-                return getId().equals(((MockComponent) obj).getId());
+                return Objects.equals(getId(), (((MockComponent) obj).getId()));
             }
 
             return false;
diff --git a/shib-spring/src/test/java/net/shibboleth/shared/spring/expression/SpringExpressionTest.java b/shib-spring/src/test/java/net/shibboleth/shared/spring/expression/SpringExpressionTest.java
index 4d8c3671..210b9f5c 100644
--- a/shib-spring/src/test/java/net/shibboleth/shared/spring/expression/SpringExpressionTest.java
+++ b/shib-spring/src/test/java/net/shibboleth/shared/spring/expression/SpringExpressionTest.java
@@ -82,6 +82,7 @@ public class SpringExpressionTest {
         Assert.assertTrue(iter.hasNext());
         var output = new SpelExpressionParser().parseExpression("hasNext()").getValue(iter, Boolean.class);
         Assert.assertNotNull(output);
-        Assert.assertTrue(output);
+        Assert.assertTrue(output instanceof Boolean && output);
     }
-}
+
+}
\ No newline at end of file
diff --git a/shib-spring/src/test/resources/net/shibboleth/shared/spring/config/identifiableBeanPostProcessorTest.xml b/shib-spring/src/test/resources/net/shibboleth/shared/spring/config/identifiableBeanPostProcessorTest.xml
index 32478673..5dd91b27 100644
--- a/shib-spring/src/test/resources/net/shibboleth/shared/spring/config/identifiableBeanPostProcessorTest.xml
+++ b/shib-spring/src/test/resources/net/shibboleth/shared/spring/config/identifiableBeanPostProcessorTest.xml
@@ -4,7 +4,7 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
 	default-init-method="initialize" default-destroy-method="destroy">
 
-	<bean class="net.shibboleth.shared.spring.config.IdentifiableBeanPostProcessor" />
+	<bean class="net.shibboleth.shared.spring.config.IdentifiableBeanPostProcessor" destroy-method="" />
 
 	<bean id="IdentifiedBean"
 		class="net.shibboleth.shared.spring.config.IdentifiableBeanPostProcessorTest$Identified"
diff --git a/shib-support/src/main/java/net/shibboleth/shared/resource/Resource.java b/shib-support/src/main/java/net/shibboleth/shared/resource/Resource.java
index e5f592f0..4371feb8 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/resource/Resource.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/resource/Resource.java
@@ -136,7 +136,7 @@ public interface Resource {
      * @return the resource handle for the relative resource
      * @throws IOException if the relative resource cannot be determined
      */
-    @Nonnull Resource createRelativeResource(String relativePath) throws IOException;
+    @Nonnull Resource createRelativeResource(@Nonnull final String relativePath) throws IOException;
 
     /**
      * Determine a filename for this resource, i.e. typically the last part of the path: for example, "myfile.txt".

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


More information about the commits mailing list