Skip to content

Commit 5915db0

Browse files
committed
Merge branch '3.1.x'
2 parents d7f4a8c + 85cfa47 commit 5915db0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,14 @@ void doesNotCloseJarFromCachedConnection() throws Exception {
9696
File jarFile = createResourcesJar("test-resources.jar");
9797
TrackedURLStreamHandler handler = new TrackedURLStreamHandler(true);
9898
URL url = new URL("jar", null, 0, jarFile.toURI().toURL().toString() + "!/", handler);
99-
new StaticResourceJars().getUrlsFrom(url);
100-
assertThatNoException()
101-
.isThrownBy(() -> ((JarURLConnection) handler.getConnection()).getJarFile().getComment());
99+
try {
100+
new StaticResourceJars().getUrlsFrom(url);
101+
assertThatNoException()
102+
.isThrownBy(() -> ((JarURLConnection) handler.getConnection()).getJarFile().getComment());
103+
}
104+
finally {
105+
((JarURLConnection) handler.getConnection()).getJarFile().close();
106+
}
102107
}
103108

104109
@Test

0 commit comments

Comments
 (0)