Skip to content

Commit 32442fa

Browse files
committed
Split dir
1 parent f6dd097 commit 32442fa

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/org/codehaus/plexus/archiver/zip/ConcurrentJarCreator.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
public class ConcurrentJarCreator {
3636

3737
private final ScatterZipOutputStream directories;
38+
private final ScatterZipOutputStream metaInfDir;
3839
private final ScatterZipOutputStream manifest;
3940

4041
private final ParallelScatterZipCreator parallelScatterZipCreator;
@@ -59,6 +60,7 @@ public ConcurrentJarCreator(int nThreads) throws IOException {
5960

6061
directories = createDeferred(defaultSupplier);
6162
manifest = createDeferred(defaultSupplier);
63+
metaInfDir = createDeferred( defaultSupplier );
6264

6365
parallelScatterZipCreator = new ParallelScatterZipCreator(Executors.newFixedThreadPool(nThreads), defaultSupplier);
6466
}
@@ -80,7 +82,13 @@ public void addArchiveEntry(final ZipArchiveEntry zipArchiveEntry, final InputSt
8082
final ByteArrayInputStream payload = new ByteArrayInputStream(new byte[]{});
8183
directories.addArchiveEntry(createZipArchiveEntryRequest(zipArchiveEntry, createInputStreamSupplier(payload)));
8284
payload.close();
83-
} else if ("META-INF".equals(zipArchiveEntry.getName()) || "META-INF/MANIFEST.MF".equals(zipArchiveEntry.getName())) {
85+
} else if ("META-INF".equals(zipArchiveEntry.getName())) {
86+
InputStream payload = source.get();
87+
if (zipArchiveEntry.isDirectory()) zipArchiveEntry.setMethod(ZipEntry.STORED);
88+
metaInfDir.addArchiveEntry(
89+
createZipArchiveEntryRequest( zipArchiveEntry, createInputStreamSupplier( payload ) ) );
90+
payload.close();
91+
} else if ("META-INF/MANIFEST.MF".equals(zipArchiveEntry.getName())) {
8492
InputStream payload = source.get();
8593
if (zipArchiveEntry.isDirectory()) zipArchiveEntry.setMethod(ZipEntry.STORED);
8694
manifest.addArchiveEntry(createZipArchiveEntryRequest(zipArchiveEntry, createInputStreamSupplier(payload)));
@@ -99,6 +107,7 @@ public InputStream get() {
99107
}
100108

101109
public void writeTo(ZipArchiveOutputStream targetStream) throws IOException, ExecutionException, InterruptedException {
110+
metaInfDir.writeTo( targetStream );
102111
manifest.writeTo(targetStream);
103112
directories.writeTo(targetStream);
104113
parallelScatterZipCreator.writeTo( targetStream);

0 commit comments

Comments
 (0)