Author: ggregory Date: Wed Nov 2 14:51:09 2011 New Revision: 1196613 URL: http://svn.apache.org/viewvc?rev=1196613&view=rev Log: [VFS-377] Replace custom TAR code with Apache Commons Compress 1.3.
Removed: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarBuffer.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarConstants.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarEntry.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarInputStream.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarUtils.java Modified: commons/proper/vfs/trunk/core/pom.xml commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/providers.xml commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java commons/proper/vfs/trunk/src/changes/changes.xml Modified: commons/proper/vfs/trunk/core/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/pom.xml?rev=1196613&r1=1196612&r2=1196613&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/pom.xml (original) +++ commons/proper/vfs/trunk/core/pom.xml Wed Nov 2 14:51:09 2011 @@ -52,7 +52,6 @@ <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-compress</artifactId> - <scope>test</scope> </dependency> <dependency> <groupId>commons-collections</groupId> Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/providers.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/providers.xml?rev=1196613&r1=1196612&r2=1196613&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/providers.xml (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/providers.xml Wed Nov 2 14:51:09 2011 @@ -25,7 +25,7 @@ </provider> <provider class-name="org.apache.commons.vfs2.provider.tar.TarFileProvider"> <scheme name="tar"/> - <if-available class-name="org.apache.commons.vfs2.provider.tar.TarInputStream"/> + <if-available class-name="org.apache.commons.compress.archivers.tar.TarArchiveOutputStream"/> </provider> <provider class-name="org.apache.commons.vfs2.provider.bzip2.Bzip2FileProvider"> Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java?rev=1196613&r1=1196612&r2=1196613&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java Wed Nov 2 14:51:09 2011 @@ -16,11 +16,10 @@ */ package org.apache.commons.vfs2.provider.tar; -//TODO: Revert to [compress] -//import org.apache.commons.compress.tar.TarEntry; import java.io.InputStream; import java.util.HashSet; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileType; @@ -33,14 +32,14 @@ import org.apache.commons.vfs2.provider. */ public class TarFileObject extends AbstractFileObject { - /** The TarEntry */ - protected TarEntry entry; + /** The TarArchiveEntry */ + protected TarArchiveEntry entry; private final HashSet<String> children = new HashSet<String>(); private final TarFileSystem fs; private FileType type; protected TarFileObject(AbstractFileName name, - TarEntry entry, + TarArchiveEntry entry, TarFileSystem fs, boolean tarExists) throws FileSystemException { @@ -56,7 +55,7 @@ public class TarFileObject extends Abstr /** * Sets the details for this file object. */ - protected void setTarEntry(final TarEntry entry) + protected void setTarEntry(final TarArchiveEntry entry) { if (this.entry != null) { Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java?rev=1196613&r1=1196612&r2=1196613&view=diff ============================================================================== --- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java (original) +++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java Wed Nov 2 14:51:09 2011 @@ -16,9 +16,6 @@ */ package org.apache.commons.vfs2.provider.tar; -//TODO: Revert to [compress] -//import org.apache.commons.compress.tar.TarEntry; -//import org.apache.commons.compress.tar.TarInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -28,6 +25,8 @@ import java.util.Collection; import java.util.List; import java.util.zip.GZIPInputStream; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; +import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.vfs2.Capability; @@ -52,7 +51,7 @@ public class TarFileSystem extends Abstr private static final Log LOG = LogFactory.getLog(TarFileSystem.class); private final File file; - private TarInputStream tarFile; + private TarArchiveInputStream tarFile; protected TarFileSystem(final AbstractFileName rootName, final FileObject parentLayer, @@ -84,8 +83,8 @@ public class TarFileSystem extends Abstr try { List<TarFileObject> strongRef = new ArrayList<TarFileObject>(100); - TarEntry entry; - while ((entry = getTarFile().getNextEntry()) != null) + TarArchiveEntry entry; + while ((entry = getTarFile().getNextTarEntry()) != null) { AbstractFileName name = (AbstractFileName) getFileSystemManager().resolveName(getRootName(), UriParser.encode(entry.getName())); @@ -136,7 +135,7 @@ public class TarFileSystem extends Abstr } } - public InputStream getInputStream(TarEntry entry) throws FileSystemException + public InputStream getInputStream(TarArchiveEntry entry) throws FileSystemException { resetTarFile(); try @@ -177,11 +176,11 @@ public class TarFileSystem extends Abstr } tarFile = null; } - TarInputStream tarFile = createTarFile(this.file); + TarArchiveInputStream tarFile = createTarFile(this.file); this.tarFile = tarFile; } - protected TarInputStream getTarFile() throws FileSystemException + protected TarArchiveInputStream getTarFile() throws FileSystemException { if (tarFile == null && this.file.exists()) { @@ -192,25 +191,25 @@ public class TarFileSystem extends Abstr } protected TarFileObject createTarFileObject(final AbstractFileName name, - final TarEntry entry) throws FileSystemException + final TarArchiveEntry entry) throws FileSystemException { return new TarFileObject(name, entry, this, true); } - protected TarInputStream createTarFile(final File file) throws FileSystemException + protected TarArchiveInputStream createTarFile(final File file) throws FileSystemException { try { if ("tgz".equalsIgnoreCase(getRootName().getScheme())) { - return new TarInputStream(new GZIPInputStream(new FileInputStream(file))); + return new TarArchiveInputStream(new GZIPInputStream(new FileInputStream(file))); } else if ("tbz2".equalsIgnoreCase(getRootName().getScheme())) { - return new TarInputStream(Bzip2FileObject.wrapInputStream(file.getAbsolutePath(), + return new TarArchiveInputStream(Bzip2FileObject.wrapInputStream(file.getAbsolutePath(), new FileInputStream(file))); } - return new TarInputStream(new FileInputStream(file)); + return new TarArchiveInputStream(new FileInputStream(file)); } catch (IOException ioe) { Modified: commons/proper/vfs/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1196613&r1=1196612&r2=1196613&view=diff ============================================================================== --- commons/proper/vfs/trunk/src/changes/changes.xml (original) +++ commons/proper/vfs/trunk/src/changes/changes.xml Wed Nov 2 14:51:09 2011 @@ -23,6 +23,9 @@ <body> <release version="2.1" date="TBD" description=""> + <action issue="VFS-377" dev="ggregory" type="update"> + Replace custom TAR code with Apache Commons Compress 1.3. + </action> <action issue="VFS-375" dev="ggregory" type="update"> Upgrade to Apache Commons Compress 1.3 from 1.2. </action>