@@ -44,12 +44,12 @@ public class ConcurrentJarCreator
4444
4545 private final boolean compressAddedZips ;
4646
47- private final ScatterZipOutputStream directories ;
48-
4947 private final ScatterZipOutputStream metaInfDir ;
5048
5149 private final ScatterZipOutputStream manifest ;
5250
51+ private final ScatterZipOutputStream directories ;
52+
5353 private final ScatterZipOutputStream synchronousEntries ;
5454
5555 private final ParallelScatterZipCreator parallelScatterZipCreator ;
@@ -123,9 +123,9 @@ public ConcurrentJarCreator( boolean compressAddedZips, int nThreads ) throws IO
123123 {
124124 this .compressAddedZips = compressAddedZips ;
125125 ScatterGatherBackingStoreSupplier defaultSupplier = new DeferredSupplier ( 100000000 / nThreads );
126- directories = createDeferred ( defaultSupplier );
127- manifest = createDeferred ( defaultSupplier );
128126 metaInfDir = createDeferred ( defaultSupplier );
127+ manifest = createDeferred ( defaultSupplier );
128+ directories = createDeferred ( defaultSupplier );
129129 synchronousEntries = createDeferred ( defaultSupplier );
130130 parallelScatterZipCreator = new ParallelScatterZipCreator ( Executors .newFixedThreadPool ( nThreads ),
131131 defaultSupplier );
@@ -152,20 +152,10 @@ public void addArchiveEntry( final ZipArchiveEntry zipArchiveEntry, final InputS
152152 {
153153 throw new IllegalArgumentException ( "Method must be set on the supplied zipArchiveEntry" );
154154 }
155- if ( zipArchiveEntry .isDirectory () && !zipArchiveEntry .isUnixSymlink () )
156- {
157- final ByteArrayInputStream payload = new ByteArrayInputStream ( new byte []
158- {
159- } );
160-
161- directories .addArchiveEntry ( createZipArchiveEntryRequest ( zipArchiveEntry , createInputStreamSupplier (
162- payload ) ) );
163-
164- payload .close ();
165- }
166- else if ( "META-INF" .equals ( zipArchiveEntry .getName () ) || "META-INF/" .equals ( zipArchiveEntry .getName () ) )
155+ if ( "META-INF" .equals ( zipArchiveEntry .getName () ) || "META-INF/" .equals ( zipArchiveEntry .getName () ) )
167156 {
168157 InputStream payload = source .get ();
158+ // TODO This should be enforced because META-INF non-directory does not make any sense?!
169159 if ( zipArchiveEntry .isDirectory () )
170160 {
171161 zipArchiveEntry .setMethod ( ZipEntry .STORED );
@@ -178,6 +168,7 @@ else if ( "META-INF".equals( zipArchiveEntry.getName() ) || "META-INF/".equals(
178168 else if ( "META-INF/MANIFEST.MF" .equals ( zipArchiveEntry .getName () ) )
179169 {
180170 InputStream payload = source .get ();
171+ // TODO This should be enforced because META-INF/MANIFEST as non-file does not make any sense?!
181172 if ( zipArchiveEntry .isDirectory () )
182173 {
183174 zipArchiveEntry .setMethod ( ZipEntry .STORED );
@@ -187,6 +178,17 @@ else if ( "META-INF/MANIFEST.MF".equals( zipArchiveEntry.getName() ) )
187178
188179 payload .close ();
189180 }
181+ else if ( zipArchiveEntry .isDirectory () && !zipArchiveEntry .isUnixSymlink () )
182+ {
183+ final ByteArrayInputStream payload = new ByteArrayInputStream ( new byte []
184+ {
185+ } );
186+
187+ directories .addArchiveEntry ( createZipArchiveEntryRequest ( zipArchiveEntry , createInputStreamSupplier (
188+ payload ) ) );
189+
190+ payload .close ();
191+ }
190192 else if ( addInParallel )
191193 {
192194 parallelScatterZipCreator .addArchiveEntry ( createEntrySupplier ( zipArchiveEntry , source ) );
0 commit comments