From 1293c3bea06432b930b93e7bb72cdde3bd37d9e2 Mon Sep 17 00:00:00 2001 From: Conor MacNeill Date: Fri, 22 Feb 2002 13:01:59 +0000 Subject: [PATCH] Do not require tar files to be in ustar format. Old V7 format should now be handled. The main difference is in the handling of uid vs uname which isn't that relevant to Ant anyhow. PR: 6634 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271510 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/tar/TarInputStream.java | 30 +++---------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/src/main/org/apache/tools/tar/TarInputStream.java b/src/main/org/apache/tools/tar/TarInputStream.java index 028522fa4..4a9529a6a 100644 --- a/src/main/org/apache/tools/tar/TarInputStream.java +++ b/src/main/org/apache/tools/tar/TarInputStream.java @@ -83,7 +83,8 @@ public class TarInputStream extends FilterInputStream { protected byte[] readBuf; protected TarBuffer buffer; protected TarEntry currEntry; - + private boolean v7Format; + public TarInputStream(InputStream is) { this(is, TarBuffer.DEFAULT_BLKSIZE, TarBuffer.DEFAULT_RCDSIZE); } @@ -100,6 +101,7 @@ public class TarInputStream extends FilterInputStream { this.oneBuf = new byte[1]; this.debug = false; this.hasHitEOF = false; + this.v7Format = false; } /** @@ -248,31 +250,7 @@ public class TarInputStream extends FilterInputStream { if (!(headerBuf[257] == 'u' && headerBuf[258] == 's' && headerBuf[259] == 't' && headerBuf[260] == 'a' && headerBuf[261] == 'r')) { - this.entrySize = 0; - this.entryOffset = 0; - this.currEntry = null; - - throw new IOException("bad header in block " - + this.buffer.getCurrentBlockNum() - + " record " - + this.buffer.getCurrentRecordNum() - + ", " + - "header magic is not 'ustar', but '" - + headerBuf[257] - + headerBuf[258] - + headerBuf[259] - + headerBuf[260] - + headerBuf[261] - + "', or (dec) " - + ((int) headerBuf[257]) - + ", " - + ((int) headerBuf[258]) - + ", " - + ((int) headerBuf[259]) - + ", " - + ((int) headerBuf[260]) - + ", " - + ((int) headerBuf[261])); + this.v7Format = true; } if (this.debug) {