mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-108213: ZipException on attempt to extract non-existent jar when building artifact
This commit is contained in:
+2
@@ -50,6 +50,8 @@ public class JarBasedArtifactRootDescriptor extends ArtifactRootDescriptor {
|
||||
}
|
||||
|
||||
public void processEntries(EntryProcessor processor) throws IOException {
|
||||
if (!myRoot.isFile()) return;
|
||||
|
||||
String prefix = StringUtil.trimStart(myPathInJar, "/");
|
||||
if (!StringUtil.endsWithChar(prefix, '/')) prefix += "/";
|
||||
if (prefix.equals("/")) {
|
||||
|
||||
+12
@@ -405,6 +405,18 @@ public class ArtifactBuilderTest extends ArtifactBuilderTestCase {
|
||||
assertEmptyOutput(a);
|
||||
}
|
||||
|
||||
public void testExtractNonExistentJarFile() {
|
||||
JpsArtifact a = addArtifact(root().extractedDir("this-file-does-not-exist.jar", "/"));
|
||||
buildAll();
|
||||
assertEmptyOutput(a);
|
||||
}
|
||||
|
||||
public void testRepackNonExistentJarFile() {
|
||||
JpsArtifact a = addArtifact(archive("a.jar").extractedDir("this-file-does-not-exist.jar", "/").fileCopy(createFile("a.txt")));
|
||||
buildAll();
|
||||
assertOutput(a, fs().archive("a.jar").file("a.txt"));
|
||||
}
|
||||
|
||||
private static void createFileInArtifactOutput(JpsArtifact a, final String fileName) throws IOException {
|
||||
assertTrue(new File(a.getOutputPath(), fileName).createNewFile());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user