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 {
List<URL> urls = new ArrayList<>(50);
while (archives.hasNext()) {
Archive archive = archives.next();
urls.add(archive.getUrl());
archive.close();
urls.add(archives.next().getUrl());
}
return createClassLoader(urls.toArray(new URL[0]));
}

@ -233,12 +233,13 @@ class PropertiesLauncherTests {
@Test
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");
this.launcher = new PropertiesLauncher();
List<Archive> archives = new ArrayList<>();
this.launcher.getClassPathArchivesIterator().forEachRemaining(archives::add);
assertThat(archives).hasSize(1).areExactly(1, endingWith("foo.jar!/"));
assertThat(ReflectionTestUtils.getField(this.launcher, "paths").toString())
.isEqualTo("[nested-jars/nested-jar-app.jar!/BOOT-INF/classes/]");
this.launcher.launch(new String[0]);
waitFor("Hello World");
}
@Test

Loading…
Cancel
Save