Author: bodewig Date: Wed Aug 17 14:07:12 2011 New Revision: 1158723 URL: http://svn.apache.org/viewvc?rev=1158723&view=rev Log: make extraction tests pass for dump. COMPRESS-132
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java?rev=1158723&r1=1158722&r2=1158723&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java Wed Aug 17 14:07:12 2011 @@ -654,6 +654,13 @@ public class DumpArchiveEntry implements * Returns the size of the entry. */ public long getSize() { + return isDirectory() ? SIZE_UNKNOWN : size; + } + + /** + * Returns the size of the entry as read from the archive. + */ + long getEntrySize() { return size; } Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java?rev=1158723&r1=1158722&r2=1158723&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java Wed Aug 17 14:07:12 2011 @@ -250,7 +250,7 @@ public class DumpArchiveInputStream exte readIdx = active.getHeaderCount(); } else { entryOffset = 0; - entrySize = active.getSize(); + entrySize = active.getEntrySize(); readIdx = 0; } @@ -277,7 +277,7 @@ public class DumpArchiveInputStream exte */ private void readDirectoryEntry(DumpArchiveEntry entry) throws IOException { - long size = entry.getSize(); + long size = entry.getEntrySize(); boolean first = true; while (first || Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java?rev=1158723&r1=1158722&r2=1158723&view=diff ============================================================================== --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java Wed Aug 17 14:07:12 2011 @@ -94,11 +94,11 @@ public final class DumpTestCase extends } } - public void XtestCheckArchive() throws Exception { + public void testCheckArchive() throws Exception { checkDumpArchive(getFile("bla.dump")); } - public void XtestCheckCompressedArchive() throws Exception { + public void testCheckCompressedArchive() throws Exception { checkDumpArchive(getFile("bla.z.dump")); }