Skip to content

Commit 6619dfa

Browse files
committed
Merge branch '2.3.x'
Closes gh-23241
2 parents bcb294d + e7e77a9 commit 6619dfa

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ protected ClassLoader createClassLoader(List<Archive> archives) throws Exception
8080
protected ClassLoader createClassLoader(Iterator<Archive> archives) throws Exception {
8181
List<URL> urls = new ArrayList<>(50);
8282
while (archives.hasNext()) {
83-
Archive archive = archives.next();
84-
urls.add(archive.getUrl());
85-
archive.close();
83+
urls.add(archives.next().getUrl());
8684
}
8785
return createClassLoader(urls.toArray(new URL[0]));
8886
}

spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,13 @@ void testUserSpecifiedJarFileWithNestedArchives() throws Exception {
233233

234234
@Test
235235
void testUserSpecifiedNestedJarPath() throws Exception {
236-
System.setProperty("loader.path", "nested-jars/app.jar!/foo.jar");
236+
System.setProperty("loader.path", "nested-jars/nested-jar-app.jar!/BOOT-INF/classes/");
237237
System.setProperty("loader.main", "demo.Application");
238238
this.launcher = new PropertiesLauncher();
239-
List<Archive> archives = new ArrayList<>();
240-
this.launcher.getClassPathArchivesIterator().forEachRemaining(archives::add);
241-
assertThat(archives).hasSize(1).areExactly(1, endingWith("foo.jar!/"));
239+
assertThat(ReflectionTestUtils.getField(this.launcher, "paths").toString())
240+
.isEqualTo("[nested-jars/nested-jar-app.jar!/BOOT-INF/classes/]");
241+
this.launcher.launch(new String[0]);
242+
waitFor("Hello World");
242243
}
243244

244245
@Test

0 commit comments

Comments
 (0)