Merge branch '2.3.x'

Closes gh-23241
pull/23246/head
Andy Wilkinson 4 years ago
commit 6619dfacf3

@ -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 {
@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

Loading…
Cancel
Save