Commit c1b34d03 authored by hengyunabc's avatar hengyunabc Committed by Andy Wilkinson

Prefer file: to jar:file: URLs in launcher

See gh-16248
parent 84530ce3
...@@ -117,7 +117,7 @@ public class ExplodedArchive implements Archive { ...@@ -117,7 +117,7 @@ public class ExplodedArchive implements Archive {
protected Archive getNestedArchive(Entry entry) throws IOException { protected Archive getNestedArchive(Entry entry) throws IOException {
File file = ((FileEntry) entry).getFile(); File file = ((FileEntry) entry).getFile();
return (file.isDirectory() ? new ExplodedArchive(file) return (file.isDirectory() ? new ExplodedArchive(file)
: new JarFileArchive(file)); : new JarFileArchive(file, file.toURI().toURL()));
} }
@Override @Override
......
...@@ -44,9 +44,7 @@ public class JarLauncherTests extends AbstractExecutableArchiveLauncherTests { ...@@ -44,9 +44,7 @@ public class JarLauncherTests extends AbstractExecutableArchiveLauncherTests {
assertThat(archives).hasSize(2); assertThat(archives).hasSize(2);
assertThat(getUrls(archives)).containsOnly( assertThat(getUrls(archives)).containsOnly(
new File(explodedRoot, "BOOT-INF/classes").toURI().toURL(), new File(explodedRoot, "BOOT-INF/classes").toURI().toURL(),
new URL("jar:" new File(explodedRoot, "BOOT-INF/lib/foo.jar").toURI().toURL());
+ new File(explodedRoot, "BOOT-INF/lib/foo.jar").toURI().toURL()
+ "!/"));
} }
@Test @Test
......
...@@ -142,7 +142,7 @@ public class PropertiesLauncherTests { ...@@ -142,7 +142,7 @@ public class PropertiesLauncherTests {
assertThat(ReflectionTestUtils.getField(launcher, "paths").toString()) assertThat(ReflectionTestUtils.getField(launcher, "paths").toString())
.isEqualTo("[jars/]"); .isEqualTo("[jars/]");
List<Archive> archives = launcher.getClassPathArchives(); List<Archive> archives = launcher.getClassPathArchives();
assertThat(archives).areExactly(1, endingWith("app.jar!/")); assertThat(archives).areExactly(1, endingWith("app.jar"));
} }
@Test @Test
......
...@@ -44,9 +44,7 @@ public class WarLauncherTests extends AbstractExecutableArchiveLauncherTests { ...@@ -44,9 +44,7 @@ public class WarLauncherTests extends AbstractExecutableArchiveLauncherTests {
assertThat(archives).hasSize(2); assertThat(archives).hasSize(2);
assertThat(getUrls(archives)).containsOnly( assertThat(getUrls(archives)).containsOnly(
new File(explodedRoot, "WEB-INF/classes").toURI().toURL(), new File(explodedRoot, "WEB-INF/classes").toURI().toURL(),
new URL("jar:" new File(explodedRoot, "WEB-INF/lib/foo.jar").toURI().toURL());
+ new File(explodedRoot, "WEB-INF/lib/foo.jar").toURI().toURL()
+ "!/"));
} }
@Test @Test
......
...@@ -127,7 +127,7 @@ public class ExplodedArchiveTests { ...@@ -127,7 +127,7 @@ public class ExplodedArchiveTests {
Entry entry = getEntriesMap(this.archive).get("nested.jar"); Entry entry = getEntriesMap(this.archive).get("nested.jar");
Archive nested = this.archive.getNestedArchive(entry); Archive nested = this.archive.getNestedArchive(entry);
assertThat(nested.getUrl().toString()) assertThat(nested.getUrl().toString())
.isEqualTo("jar:" + this.rootFolder.toURI() + "nested.jar!/"); .isEqualTo(this.rootFolder.toURI() + "nested.jar");
} }
@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