Author: bodewig
Date: Wed Mar 18 04:38:47 2009
New Revision: 755472

URL: http://svn.apache.org/viewvc?rev=755472&view=rev
Log:
use proper size for directories - SANDBOX-303

Modified:
    
commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
    
commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java

Modified: 
commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java?rev=755472&r1=755471&r2=755472&view=diff
==============================================================================
--- 
commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
 (original)
+++ 
commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
 Wed Mar 18 04:38:47 2009
@@ -212,12 +212,13 @@
             if (nameLength == 0 || name.charAt(nameLength - 1) != '/') {
                 this.name.append("/");
             }
+            this.size = 0;
         } else {
             this.mode = DEFAULT_FILE_MODE;
             this.linkFlag = LF_NORMAL;
+            this.size = file.length();
         }
 
-        this.size = file.length();
         this.modTime = file.lastModified() / MILLIS_PER_SECOND;
         this.devMajor = 0;
         this.devMinor = 0;

Modified: 
commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java?rev=755472&r1=755471&r2=755472&view=diff
==============================================================================
--- 
commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java
 (original)
+++ 
commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveEntryTest.java
 Wed Mar 18 04:38:47 2009
@@ -50,7 +50,6 @@
         try {
             tout = new TarArchiveOutputStream(new FileOutputStream(f));
             TarArchiveEntry t = new TarArchiveEntry(new File(ROOT));
-            t.setSize(0);
             tout.putNextEntry(t);
             tout.closeEntry();
             t = new TarArchiveEntry(new File(new File(ROOT), "foo.txt"));


Reply via email to