Skip to content

Commit

Permalink
Check if file (still)is present in the ZipComparator
Browse files Browse the repository at this point in the history
If nested jars are compared the file of the baseline is only transient
and can't be accessed after the compare.

In this case, simply do not copy the files and instead assume it was
already written out as part of the outer comparison delta operation.

(cherry picked from commit e6dab28)
  • Loading branch information
laeubi committed Dec 25, 2023
1 parent 6bf3aee commit 1c57bf4
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
Expand Down Expand Up @@ -99,9 +100,16 @@ public ZipArtifactDelta(Map<String, ? extends ArtifactDelta> members, File basel

@Override
public void writeDetails(File basedir) throws IOException {
basedir.mkdirs();
super.writeDetails(basedir);
Files.copy(baseline.toPath(), basedir.toPath().resolve("baseline-" + baseline.getName()));
Files.copy(reactor.toPath(), basedir.toPath().resolve("build-" + reactor.getName()));
if (baseline.isFile()) {
Files.copy(baseline.toPath(), basedir.toPath().resolve("baseline-" + baseline.getName()),
StandardCopyOption.REPLACE_EXISTING);
}
if (reactor.isFile()) {
Files.copy(reactor.toPath(), basedir.toPath().resolve("build-" + reactor.getName()),
StandardCopyOption.REPLACE_EXISTING);
}
}

}
Expand Down

0 comments on commit 1c57bf4

Please sign in to comment.