Tolerate jar files with no manifest in ChangeableUrls
Closes gh-5704
This commit is contained in:
@@ -24,6 +24,7 @@ import java.net.URLClassLoader;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -80,7 +81,7 @@ public class ChangeableUrlsTests {
|
||||
File relative = this.temporaryFolder.newFolder();
|
||||
ChangeableUrls urls = ChangeableUrls.fromUrlClassLoader(new URLClassLoader(
|
||||
new URL[] { makeJarFileWithUrlsInManifestClassPath(projectCore,
|
||||
projectWeb, relative.getName() + "/") }));
|
||||
projectWeb, relative.getName() + "/"), makeJarFileWithNoManifest() }));
|
||||
assertThat(urls.toList(),
|
||||
contains(projectCore, projectWeb, relative.toURI().toURL()));
|
||||
}
|
||||
@@ -105,4 +106,10 @@ public class ChangeableUrlsTests {
|
||||
return classpathJar.toURI().toURL();
|
||||
}
|
||||
|
||||
private URL makeJarFileWithNoManifest() throws Exception {
|
||||
File classpathJar = this.temporaryFolder.newFile("no-manifest.jar");
|
||||
new ZipOutputStream(new FileOutputStream(classpathJar)).close();
|
||||
return classpathJar.toURI().toURL();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user