Author: sebb Date: Mon May 10 14:12:34 2010 New Revision: 942746 URL: http://svn.apache.org/viewvc?rev=942746&view=rev Log: COMPRESS-107 - recognise Ant tar files
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java?rev=942746&r1=942745&r2=942746&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java Mon May 10 14:12:34 2010 @@ -326,27 +326,36 @@ public class TarArchiveInputStream exten return false; } - if (ArchiveUtils.matchAsciiBuffer(TarConstants.MAGIC_POSIX, + if (ArchiveUtils.matchAsciiBuffer(TarConstants.MAGIC_POSIX, signature, TarConstants.MAGIC_OFFSET, TarConstants.MAGICLEN) && - ArchiveUtils.matchAsciiBuffer(TarConstants.VERSION_POSIX, + ArchiveUtils.matchAsciiBuffer(TarConstants.VERSION_POSIX, signature, TarConstants.VERSION_OFFSET, TarConstants.VERSIONLEN) ){ return true; } - if (ArchiveUtils.matchAsciiBuffer(TarConstants.MAGIC_GNU, + if (ArchiveUtils.matchAsciiBuffer(TarConstants.MAGIC_GNU, signature, TarConstants.MAGIC_OFFSET, TarConstants.MAGICLEN) && ( - ArchiveUtils.matchAsciiBuffer(TarConstants.VERSION_GNU_SPACE, + ArchiveUtils.matchAsciiBuffer(TarConstants.VERSION_GNU_SPACE, signature, TarConstants.VERSION_OFFSET, TarConstants.VERSIONLEN) || - ArchiveUtils.matchAsciiBuffer(TarConstants.VERSION_GNU_ZERO, + ArchiveUtils.matchAsciiBuffer(TarConstants.VERSION_GNU_ZERO, signature, TarConstants.VERSION_OFFSET, TarConstants.VERSIONLEN) ) ){ return true; } + // COMPRESS-107 - recognise Ant tar files + if (ArchiveUtils.matchAsciiBuffer(TarConstants.MAGIC_ANT, + signature, TarConstants.MAGIC_OFFSET, TarConstants.MAGICLEN) + && + ArchiveUtils.matchAsciiBuffer(TarConstants.VERSION_ANT, + signature, TarConstants.VERSION_OFFSET, TarConstants.VERSIONLEN) + ){ + return true; + } return false; }