[spring-extensions] 01/02: Remove use of the deprecated Spring Assert and replace with our Constraints framework

Rod Widdowson rdw at steadingsoftware.com
Tue Aug 8 11:21:31 EDT 2017


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

rdw pushed a commit to branch master
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=247b962a828a7e2ee9143342902dce15d3b8f9f2

commit 247b962a828a7e2ee9143342902dce15d3b8f9f2
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Aug 8 16:09:45 2017 +0100

    Remove use of the deprecated Spring Assert and replace with our Constraints framework
---
 .../ext/spring/context/FileSystemXmlWebApplicationContext.java | 10 ++++++----
 .../ext/spring/resource/PreferFileSystemResourceLoader.java    |  5 +++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/main/java/net/shibboleth/ext/spring/context/FileSystemXmlWebApplicationContext.java b/src/main/java/net/shibboleth/ext/spring/context/FileSystemXmlWebApplicationContext.java
index a642b26..597571f 100644
--- a/src/main/java/net/shibboleth/ext/spring/context/FileSystemXmlWebApplicationContext.java
+++ b/src/main/java/net/shibboleth/ext/spring/context/FileSystemXmlWebApplicationContext.java
@@ -17,16 +17,18 @@
 
 package net.shibboleth.ext.spring.context;
 
-import net.shibboleth.ext.spring.util.AnnotationParameterNameDiscoverer;
+import javax.annotation.Nonnull;
 
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.FileSystemResource;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.support.ResourcePatternResolver;
-import org.springframework.util.Assert;
 import org.springframework.web.context.support.XmlWebApplicationContext;
 
+import net.shibboleth.ext.spring.util.AnnotationParameterNameDiscoverer;
+import net.shibboleth.utilities.java.support.logic.Constraint;
+
 /**
  * An extension of {@link XmlWebApplicationContext} that (1) is biased in favor of the filesystem such that bare
  * resource paths are assumed to be files rather than classpath resources and (2) supports loading "classpath*:"
@@ -58,8 +60,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) {
-        Assert.notNull(location, "Location must not be null");
+    @Override 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()),
                     getClassLoader());
diff --git a/src/main/java/net/shibboleth/ext/spring/resource/PreferFileSystemResourceLoader.java b/src/main/java/net/shibboleth/ext/spring/resource/PreferFileSystemResourceLoader.java
index 9371e02..0d228e6 100644
--- a/src/main/java/net/shibboleth/ext/spring/resource/PreferFileSystemResourceLoader.java
+++ b/src/main/java/net/shibboleth/ext/spring/resource/PreferFileSystemResourceLoader.java
@@ -22,7 +22,8 @@ import org.springframework.core.io.DefaultResourceLoader;
 import org.springframework.core.io.FileSystemResource;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.support.ResourcePatternResolver;
-import org.springframework.util.Assert;
+
+import net.shibboleth.utilities.java.support.logic.Constraint;
 
 /**
  * An extension of {@link DefaultResourceLoader} that (1) is biased in favor of the filesystem such that bare resource
@@ -56,7 +57,7 @@ public class PreferFileSystemResourceLoader extends DefaultResourceLoader {
      * </p>
      */
     @Override public Resource getResource(final String location) {
-        Assert.notNull(location, "Location must not be null");
+        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()),
                     getClassLoader());

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


More information about the commits mailing list