Skip to content

Commit 365f65d

Browse files
committed
Merge branch '2.2.x'
Closes gh-21321
2 parents 720d23a + 98d27db commit 365f65d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/StaticResourceJars.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.net.URL;
2626
import java.net.URLClassLoader;
2727
import java.net.URLConnection;
28+
import java.nio.file.InvalidPathException;
2829
import java.util.ArrayList;
2930
import java.util.List;
3031
import java.util.jar.JarFile;
@@ -124,7 +125,7 @@ private boolean isResourcesJar(File file) {
124125
try {
125126
return isResourcesJar(new JarFile(file));
126127
}
127-
catch (IOException ex) {
128+
catch (IOException | InvalidPathException ex) {
128129
return false;
129130
}
130131
}

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/StaticResourceJarsTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ void uncPathsAreTolerated() throws Exception {
7777
assertThat(staticResourceJarUrls).hasSize(1);
7878
}
7979

80+
@Test
81+
void ignoreWildcardUrls() throws Exception {
82+
File jarFile = createResourcesJar("test-resources.jar");
83+
URL folderUrl = jarFile.getParentFile().toURI().toURL();
84+
URL wildcardUrl = new URL(folderUrl.toString() + "*.jar");
85+
List<URL> staticResourceJarUrls = new StaticResourceJars().getUrlsFrom(wildcardUrl);
86+
assertThat(staticResourceJarUrls).isEmpty();
87+
}
88+
8089
private File createResourcesJar(String name) throws IOException {
8190
return createJar(name, (output) -> {
8291
JarEntry jarEntry = new JarEntry("META-INF/resources");

0 commit comments

Comments
 (0)