Commit 98d27db7 authored by Phillip Webb's avatar Phillip Webb

Merge branch '2.1.x' into 2.2.x

Closes gh-21320
parents 487329fa df70c42f
...@@ -25,6 +25,7 @@ import java.net.URISyntaxException; ...@@ -25,6 +25,7 @@ import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.net.URLConnection; import java.net.URLConnection;
import java.nio.file.InvalidPathException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.jar.JarFile; import java.util.jar.JarFile;
...@@ -124,7 +125,7 @@ class StaticResourceJars { ...@@ -124,7 +125,7 @@ class StaticResourceJars {
try { try {
return isResourcesJar(new JarFile(file)); return isResourcesJar(new JarFile(file));
} }
catch (IOException ex) { catch (IOException | InvalidPathException ex) {
return false; return false;
} }
} }
......
...@@ -77,6 +77,15 @@ class StaticResourceJarsTests { ...@@ -77,6 +77,15 @@ class StaticResourceJarsTests {
assertThat(staticResourceJarUrls).hasSize(1); assertThat(staticResourceJarUrls).hasSize(1);
} }
@Test
void ignoreWildcardUrls() throws Exception {
File jarFile = createResourcesJar("test-resources.jar");
URL folderUrl = jarFile.getParentFile().toURI().toURL();
URL wildcardUrl = new URL(folderUrl.toString() + "*.jar");
List<URL> staticResourceJarUrls = new StaticResourceJars().getUrlsFrom(wildcardUrl);
assertThat(staticResourceJarUrls).isEmpty();
}
private File createResourcesJar(String name) throws IOException { private File createResourcesJar(String name) throws IOException {
return createJar(name, (output) -> { return createJar(name, (output) -> {
JarEntry jarEntry = new JarEntry("META-INF/resources"); JarEntry jarEntry = new JarEntry("META-INF/resources");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment