ResourcePatternUtils.getResourcePatternResolver actually accepts null argument
Issue: SPR-14500
(cherry picked from commit e756a5b)
This commit is contained in:
parent
5a92aa4e06
commit
8ccfdbbcf9
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -17,12 +17,11 @@
|
||||||
package org.springframework.core.io.support;
|
package org.springframework.core.io.support;
|
||||||
|
|
||||||
import org.springframework.core.io.ResourceLoader;
|
import org.springframework.core.io.ResourceLoader;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
import org.springframework.util.ResourceUtils;
|
import org.springframework.util.ResourceUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class for determining whether a given URL is a resource
|
* Utility class for determining whether a given URL is a resource
|
||||||
* location that can be loaded via a ResourcePatternResolver.
|
* location that can be loaded via a {@link ResourcePatternResolver}.
|
||||||
*
|
*
|
||||||
* <p>Callers will usually assume that a location is a relative path
|
* <p>Callers will usually assume that a location is a relative path
|
||||||
* if the {@link #isUrl(String)} method returns {@code false}.
|
* if the {@link #isUrl(String)} method returns {@code false}.
|
||||||
|
|
@ -59,7 +58,6 @@ public abstract class ResourcePatternUtils {
|
||||||
* @see PathMatchingResourcePatternResolver
|
* @see PathMatchingResourcePatternResolver
|
||||||
*/
|
*/
|
||||||
public static ResourcePatternResolver getResourcePatternResolver(ResourceLoader resourceLoader) {
|
public static ResourcePatternResolver getResourcePatternResolver(ResourceLoader resourceLoader) {
|
||||||
Assert.notNull(resourceLoader, "ResourceLoader must not be null");
|
|
||||||
if (resourceLoader instanceof ResourcePatternResolver) {
|
if (resourceLoader instanceof ResourcePatternResolver) {
|
||||||
return (ResourcePatternResolver) resourceLoader;
|
return (ResourcePatternResolver) resourceLoader;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue