Commit 7eb91938 authored by Andy Wilkinson's avatar Andy Wilkinson

Tolerate absolute URLs in manifest's Class-Path attribute

Closes gh-10268
parent 0a8b355c
...@@ -143,7 +143,10 @@ final class ChangeableUrls implements Iterable<URL> { ...@@ -143,7 +143,10 @@ final class ChangeableUrls implements Iterable<URL> {
List<File> nonExistentEntries = new ArrayList<File>(); List<File> nonExistentEntries = new ArrayList<File>();
for (String entry : entries) { for (String entry : entries) {
try { try {
File referenced = new File(parent, entry); File referenced = new File(entry);
if (!referenced.isAbsolute()) {
referenced = new File(parent, entry);
}
if (referenced.exists()) { if (referenced.exists()) {
urls.add(referenced.toURI().toURL()); urls.add(referenced.toURI().toURL());
} }
......
...@@ -75,9 +75,11 @@ public class ChangeableUrlsTests { ...@@ -75,9 +75,11 @@ public class ChangeableUrlsTests {
@Test @Test
public void urlsFromJarClassPathAreConsidered() throws Exception { public void urlsFromJarClassPathAreConsidered() throws Exception {
File relative = this.temporaryFolder.newFolder(); File relative = this.temporaryFolder.newFolder();
File absolute = this.temporaryFolder.newFolder();
File jarWithClassPath = makeJarFileWithUrlsInManifestClassPath( File jarWithClassPath = makeJarFileWithUrlsInManifestClassPath(
"project-core/target/classes/", "project-web/target/classes/", "project-core/target/classes/", "project-web/target/classes/",
"does-not-exist/target/classes", relative.getName() + "/"); "does-not-exist/target/classes", relative.getName() + "/",
absolute.getAbsolutePath() + "/");
new File(jarWithClassPath.getParentFile(), "project-core/target/classes") new File(jarWithClassPath.getParentFile(), "project-core/target/classes")
.mkdirs(); .mkdirs();
new File(jarWithClassPath.getParentFile(), "project-web/target/classes").mkdirs(); new File(jarWithClassPath.getParentFile(), "project-web/target/classes").mkdirs();
...@@ -87,7 +89,7 @@ public class ChangeableUrlsTests { ...@@ -87,7 +89,7 @@ public class ChangeableUrlsTests {
assertThat(urls.toList()).containsExactly( assertThat(urls.toList()).containsExactly(
new URL(jarWithClassPath.toURI().toURL(), "project-core/target/classes/"), new URL(jarWithClassPath.toURI().toURL(), "project-core/target/classes/"),
new URL(jarWithClassPath.toURI().toURL(), "project-web/target/classes/"), new URL(jarWithClassPath.toURI().toURL(), "project-web/target/classes/"),
relative.toURI().toURL()); relative.toURI().toURL(), absolute.toURI().toURL());
} }
private URL makeUrl(String name) throws IOException { private URL makeUrl(String name) throws IOException {
......
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