Commit 6619dfac authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '2.3.x'

Closes gh-23241
parents bcb294d9 e7e77a91
...@@ -80,9 +80,7 @@ public abstract class Launcher { ...@@ -80,9 +80,7 @@ public abstract class Launcher {
protected ClassLoader createClassLoader(Iterator<Archive> archives) throws Exception { protected ClassLoader createClassLoader(Iterator<Archive> archives) throws Exception {
List<URL> urls = new ArrayList<>(50); List<URL> urls = new ArrayList<>(50);
while (archives.hasNext()) { while (archives.hasNext()) {
Archive archive = archives.next(); urls.add(archives.next().getUrl());
urls.add(archive.getUrl());
archive.close();
} }
return createClassLoader(urls.toArray(new URL[0])); return createClassLoader(urls.toArray(new URL[0]));
} }
......
...@@ -233,12 +233,13 @@ class PropertiesLauncherTests { ...@@ -233,12 +233,13 @@ class PropertiesLauncherTests {
@Test @Test
void testUserSpecifiedNestedJarPath() throws Exception { void testUserSpecifiedNestedJarPath() throws Exception {
System.setProperty("loader.path", "nested-jars/app.jar!/foo.jar"); System.setProperty("loader.path", "nested-jars/nested-jar-app.jar!/BOOT-INF/classes/");
System.setProperty("loader.main", "demo.Application"); System.setProperty("loader.main", "demo.Application");
this.launcher = new PropertiesLauncher(); this.launcher = new PropertiesLauncher();
List<Archive> archives = new ArrayList<>(); assertThat(ReflectionTestUtils.getField(this.launcher, "paths").toString())
this.launcher.getClassPathArchivesIterator().forEachRemaining(archives::add); .isEqualTo("[nested-jars/nested-jar-app.jar!/BOOT-INF/classes/]");
assertThat(archives).hasSize(1).areExactly(1, endingWith("foo.jar!/")); this.launcher.launch(new String[0]);
waitFor("Hello World");
} }
@Test @Test
......
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