@@ -44,12 +44,12 @@ public class ConcurrentJarCreator
44
44
45
45
private final boolean compressAddedZips ;
46
46
47
- private final ScatterZipOutputStream directories ;
48
-
49
47
private final ScatterZipOutputStream metaInfDir ;
50
48
51
49
private final ScatterZipOutputStream manifest ;
52
50
51
+ private final ScatterZipOutputStream directories ;
52
+
53
53
private final ScatterZipOutputStream synchronousEntries ;
54
54
55
55
private final ParallelScatterZipCreator parallelScatterZipCreator ;
@@ -123,9 +123,9 @@ public ConcurrentJarCreator( boolean compressAddedZips, int nThreads ) throws IO
123
123
{
124
124
this .compressAddedZips = compressAddedZips ;
125
125
ScatterGatherBackingStoreSupplier defaultSupplier = new DeferredSupplier ( 100000000 / nThreads );
126
- directories = createDeferred ( defaultSupplier );
127
- manifest = createDeferred ( defaultSupplier );
128
126
metaInfDir = createDeferred ( defaultSupplier );
127
+ manifest = createDeferred ( defaultSupplier );
128
+ directories = createDeferred ( defaultSupplier );
129
129
synchronousEntries = createDeferred ( defaultSupplier );
130
130
parallelScatterZipCreator = new ParallelScatterZipCreator ( Executors .newFixedThreadPool ( nThreads ),
131
131
defaultSupplier );
@@ -152,20 +152,10 @@ public void addArchiveEntry( final ZipArchiveEntry zipArchiveEntry, final InputS
152
152
{
153
153
throw new IllegalArgumentException ( "Method must be set on the supplied zipArchiveEntry" );
154
154
}
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 () ) )
167
156
{
168
157
InputStream payload = source .get ();
158
+ // TODO This should be enforced because META-INF non-directory does not make any sense?!
169
159
if ( zipArchiveEntry .isDirectory () )
170
160
{
171
161
zipArchiveEntry .setMethod ( ZipEntry .STORED );
@@ -178,6 +168,7 @@ else if ( "META-INF".equals( zipArchiveEntry.getName() ) || "META-INF/".equals(
178
168
else if ( "META-INF/MANIFEST.MF" .equals ( zipArchiveEntry .getName () ) )
179
169
{
180
170
InputStream payload = source .get ();
171
+ // TODO This should be enforced because META-INF/MANIFEST as non-file does not make any sense?!
181
172
if ( zipArchiveEntry .isDirectory () )
182
173
{
183
174
zipArchiveEntry .setMethod ( ZipEntry .STORED );
@@ -187,6 +178,17 @@ else if ( "META-INF/MANIFEST.MF".equals( zipArchiveEntry.getName() ) )
187
178
188
179
payload .close ();
189
180
}
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
+ }
190
192
else if ( addInParallel )
191
193
{
192
194
parallelScatterZipCreator .addArchiveEntry ( createEntrySupplier ( zipArchiveEntry , source ) );
0 commit comments