Skip to content

Commit 3decb08

Browse files
committed
Converted to commons-compress for all archivers, upgraded to cc 1.8.1
A lot of semi-internal files have been removed. Clients using these files will generally find compatible eplacements with similar names in commons-compress or java.util.zip
1 parent 6d5f744 commit 3decb08

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+427
-6048
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<dependency>
6161
<groupId>org.apache.commons</groupId>
6262
<artifactId>commons-compress</artifactId>
63-
<version>1.5</version>
63+
<version>1.8.1</version>
6464
</dependency>
6565
<dependency>
6666
<groupId>junit</groupId>

src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public void setIncludeEmptyDirs( final boolean includeEmptyDirs )
250250
public void addDirectory( final File directory )
251251
throws ArchiverException
252252
{
253-
addDirectory( directory, "" );
253+
addDirectory(directory, "");
254254
}
255255

256256
public void addDirectory( final File directory, final String prefix )
@@ -262,7 +262,7 @@ public void addDirectory( final File directory, final String prefix )
262262
public void addDirectory( final File directory, final String[] includes, final String[] excludes )
263263
throws ArchiverException
264264
{
265-
addDirectory( directory, "", includes, excludes );
265+
addDirectory(directory, "", includes, excludes);
266266
}
267267

268268
public void addDirectory( final File directory, final String prefix, final String[] includes,
@@ -323,7 +323,7 @@ public void addFile( final File inputFile, final String destFileName )
323323
{
324324
final int fileMode = getOverrideFileMode();
325325

326-
addFile( inputFile, destFileName, fileMode );
326+
addFile(inputFile, destFileName, fileMode);
327327
}
328328

329329
protected ArchiveEntry asArchiveEntry( final PlexusIoResource resource, final String destFileName,
@@ -686,7 +686,7 @@ protected PlexusIoResourceCollection asResourceCollection( final ArchivedFileSet
686686
public void addResources( final PlexusIoResourceCollection collection )
687687
throws ArchiverException
688688
{
689-
resources.add( collection );
689+
resources.add(collection);
690690
}
691691

692692
public void addArchivedFileSet( final ArchivedFileSet fileSet )
@@ -727,7 +727,7 @@ public void addArchivedFileSet( final File archiveFile, final String prefix )
727727
public void addArchivedFileSet( final File archiveFile, final String[] includes, final String[] excludes )
728728
throws ArchiverException
729729
{
730-
addArchivedFileSet( archiveFile, null, includes, excludes );
730+
addArchivedFileSet(archiveFile, null, includes, excludes);
731731
}
732732

733733
/**
@@ -768,7 +768,7 @@ public void setForced( final boolean forced )
768768
this.forced = forced;
769769
}
770770

771-
public void setArchiveFilters( final List filters )
771+
public void setArchiveFilters(final List filters)
772772
{
773773
filterSupport = new FilterSupport( filters, getLogger() );
774774
}

src/main/java/org/codehaus/plexus/archiver/AbstractUnArchiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public final void extract( final String path, final File outputDirectory )
129129
runArchiveFinalizers();
130130
}
131131

132-
public void setArchiveFilters( final List filters )
132+
public void setArchiveFilters(final List filters)
133133
{
134134
filterSupport = new FilterSupport( filters, getLogger() );
135135
}

src/main/java/org/codehaus/plexus/archiver/ArchiveFile.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ public interface Entry
4242
/**
4343
* Returns an enumeration with the archive files entries.
4444
* Any element returned by the enumeration is an instance
45-
* of {@link Entry}.
45+
* of {@link org.apache.commons.compress.archivers.ArchiveEntry}.
4646
*/
47-
public Enumeration getEntries()
47+
public Enumeration<? extends org.apache.commons.compress.archivers.ArchiveEntry> getEntries()
4848
throws IOException;
4949

5050
/**
5151
* Returns an {@link InputStream} with the given entries contents.
52+
* org.apache.commons.compress.archivers.ArchiveEntry
5253
*/
53-
InputStream getInputStream( Entry entry )
54+
InputStream getInputStream(org.apache.commons.compress.archivers.ArchiveEntry entry )
5455
throws IOException;
5556
}

src/main/java/org/codehaus/plexus/archiver/FilterEnabled.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
public interface FilterEnabled
1010
{
1111

12-
void setArchiveFilters( List filters );
12+
void setArchiveFilters(List filters);
1313

1414
}

src/main/java/org/codehaus/plexus/archiver/ear/EarArchiver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
*
1818
*/
1919

20+
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
2021
import org.codehaus.plexus.archiver.ArchiveEntry;
2122
import org.codehaus.plexus.archiver.ArchiverException;
2223
import org.codehaus.plexus.archiver.jar.JarArchiver;
2324
import org.codehaus.plexus.archiver.util.ResourceUtils;
24-
import org.codehaus.plexus.archiver.zip.ZipOutputStream;
2525

2626
import java.io.File;
2727
import java.io.IOException;
@@ -79,7 +79,7 @@ public void addArchives( File directoryName, String[] includes, String[] exclude
7979
addDirectory( directoryName, "/", includes, excludes );
8080
}
8181

82-
protected void initZipOutputStream( ZipOutputStream zOut )
82+
protected void initZipOutputStream( ZipArchiveOutputStream zOut )
8383
throws IOException, ArchiverException
8484
{
8585
// If no webxml file is specified, it's an error.
@@ -94,7 +94,7 @@ protected void initZipOutputStream( ZipOutputStream zOut )
9494
/**
9595
* Overridden from ZipArchiver class to deal with application.xml
9696
*/
97-
protected void zipFile( ArchiveEntry entry, ZipOutputStream zOut, String vPath, int mode )
97+
protected void zipFile( ArchiveEntry entry, ZipArchiveOutputStream zOut, String vPath, int mode )
9898
throws IOException, ArchiverException
9999
{
100100
// If the file being added is META-INF/application.xml, we

src/main/java/org/codehaus/plexus/archiver/jar/JarArchiver.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
import java.util.StringTokenizer;
4040
import java.util.TreeMap;
4141
import java.util.Vector;
42+
43+
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
44+
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
4245
import org.codehaus.plexus.archiver.ArchiverException;
4346
import org.codehaus.plexus.archiver.util.EnumeratedAttribute;
4447
import org.codehaus.plexus.archiver.zip.ZipArchiver;
45-
import org.codehaus.plexus.archiver.zip.ZipEntry;
46-
import org.codehaus.plexus.archiver.zip.ZipFile;
47-
import org.codehaus.plexus.archiver.zip.ZipOutputStream;
4848
import org.codehaus.plexus.logging.Logger;
4949
import org.codehaus.plexus.logging.console.ConsoleLogger;
5050
import org.codehaus.plexus.util.IOUtil;
@@ -284,7 +284,7 @@ public void addConfiguredIndexJars( File indexJar )
284284
indexJars.add( indexJar.getAbsolutePath() );
285285
}
286286

287-
protected void initZipOutputStream( ZipOutputStream zOut )
287+
protected void initZipOutputStream( ZipArchiveOutputStream zOut )
288288
throws IOException, ArchiverException
289289
{
290290
if ( !skipWriting )
@@ -334,7 +334,7 @@ private Manifest createManifest()
334334
return finalManifest;
335335
}
336336

337-
private void writeManifest( ZipOutputStream zOut, Manifest manifest )
337+
private void writeManifest( ZipArchiveOutputStream zOut, Manifest manifest )
338338
throws IOException, ArchiverException
339339
{
340340
for ( Enumeration e = manifest.getWarnings(); e.hasMoreElements(); )
@@ -352,7 +352,7 @@ private void writeManifest( ZipOutputStream zOut, Manifest manifest )
352352
super.initZipOutputStream( zOut );
353353
}
354354

355-
protected void finalizeZipOutputStream( ZipOutputStream zOut )
355+
protected void finalizeZipOutputStream( ZipArchiveOutputStream zOut )
356356
throws IOException, ArchiverException
357357
{
358358
if ( index )
@@ -373,7 +373,7 @@ protected void finalizeZipOutputStream( ZipOutputStream zOut )
373373
* @throws org.codehaus.plexus.archiver.ArchiverException
374374
* .
375375
*/
376-
private void createIndexList( ZipOutputStream zOut )
376+
private void createIndexList( ZipArchiveOutputStream zOut )
377377
throws IOException, ArchiverException
378378
{
379379
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -455,7 +455,7 @@ private void createIndexList( ZipOutputStream zOut )
455455
/**
456456
* Overridden from Zip class to deal with manifests and index lists.
457457
*/
458-
protected void zipFile( InputStream is, ZipOutputStream zOut, String vPath, long lastModified, File fromArchive,
458+
protected void zipFile( InputStream is, ZipArchiveOutputStream zOut, String vPath, long lastModified, File fromArchive,
459459
int mode )
460460
throws IOException, ArchiverException
461461
{
@@ -534,21 +534,21 @@ protected boolean createEmptyZip( File zipFile )
534534
return true;
535535
}
536536

537-
ZipOutputStream zOut = null;
537+
ZipArchiveOutputStream zOut = null;
538538
try
539539
{
540540
getLogger().debug( "Building MANIFEST-only jar: " + getDestFile().getAbsolutePath() );
541541
FileOutputStream out = new FileOutputStream( getDestFile() );
542-
zOut = new ZipOutputStream( new BufferedOutputStream( out, 65536) );
542+
zOut = new ZipArchiveOutputStream( new BufferedOutputStream( out, 65536) );
543543

544544
zOut.setEncoding( getEncoding() );
545545
if ( isCompress() )
546546
{
547-
zOut.setMethod( ZipOutputStream.DEFLATED );
547+
zOut.setMethod( ZipArchiveOutputStream.DEFLATED );
548548
}
549549
else
550550
{
551-
zOut.setMethod( ZipOutputStream.STORED );
551+
zOut.setMethod( ZipArchiveOutputStream.STORED );
552552
}
553553
initZipOutputStream( zOut );
554554
finalizeZipOutputStream( zOut );
@@ -748,15 +748,15 @@ else if ( zipFile.isDirectory() )
748748
}
749749
else
750750
{
751-
ZipFile zf = null;
751+
org.apache.commons.compress.archivers.zip.ZipFile zf = null;
752752
try
753753
{
754-
zf = new ZipFile( file, "utf-8" );
755-
Enumeration<ZipEntry> entries = zf.getEntries();
754+
zf = new org.apache.commons.compress.archivers.zip.ZipFile( file, "utf-8" );
755+
Enumeration<ZipArchiveEntry> entries = zf.getEntries();
756756
HashSet<String> dirSet = new HashSet<String>();
757757
while ( entries.hasMoreElements() )
758758
{
759-
ZipEntry ze = entries.nextElement();
759+
ZipArchiveEntry ze = entries.nextElement();
760760
String name = ze.getName();
761761
// avoid index for manifest-only jars.
762762
if ( !name.equals( META_INF_NAME ) && !name.equals( META_INF_NAME + '/' ) && !name.equals(

src/main/java/org/codehaus/plexus/archiver/tar/PlexusIoTarFileResourceCollection.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import java.io.IOException;
55
import java.util.Enumeration;
66
import java.util.Iterator;
7+
8+
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
79
import org.codehaus.plexus.components.io.resources.AbstractPlexusIoArchiveResourceCollection;
810
import org.codehaus.plexus.components.io.resources.PlexusIoResource;
911

@@ -40,7 +42,7 @@ public boolean hasNext()
4042

4143
public PlexusIoResource next()
4244
{
43-
final TarEntry entry = (TarEntry) en.nextElement();
45+
final TarArchiveEntry entry = (TarArchiveEntry) en.nextElement();
4446
return new TarResource( tarFile, entry );
4547
}
4648

0 commit comments

Comments
 (0)