You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2014/04/19 08:00:20 UTC

svn commit: r1588618 - in /commons/proper/compress/trunk/src: changes/changes.xml main/java/org/apache/commons/compress/archivers/tar/TarUtils.java test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java

Author: bodewig
Date: Sat Apr 19 06:00:19 2014
New Revision: 1588618

URL: http://svn.apache.org/r1588618
Log:
COMPRESS-278 all empty numeric fields should be ignored in tars

Modified:
    commons/proper/compress/trunk/src/changes/changes.xml
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java

Modified: commons/proper/compress/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1588618&r1=1588617&r2=1588618&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Sat Apr 19 06:00:19 2014
@@ -74,6 +74,10 @@ The <action> type attribute can be add,u
       <action type="fix" date="2014-04-18" issue="COMPRESS-273">
         Added a few null checks to improve robustness.
       </action>
+      <action type="fix" date="2014-04-19" issue="COMPRESS-278">
+        TarArchiveInputStream failed to read archives with empty
+        gid/uid fields.
+      </action>
     </release>
     <release version="1.8" date="2014-03-12"
              description="Release 1.8">

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java?rev=1588618&r1=1588617&r2=1588618&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java Sat Apr 19 06:00:19 2014
@@ -130,10 +130,6 @@ public class TarUtils {
             end--;
             trailer = buffer[end - 1];
         }
-        if (start == end) {
-            throw new IllegalArgumentException(
-                    exceptionMessage(buffer, offset, length, start, trailer));
-        }
 
         for ( ;start < end; start++) {
             final byte currentByte = buffer[start];

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java?rev=1588618&r1=1588617&r2=1588618&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java (original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java Sat Apr 19 06:00:19 2014
@@ -64,6 +64,9 @@ public class TarUtilsTest extends TestCa
         buffer=new byte[]{0,' '};
         value = TarUtils.parseOctal(buffer,0, buffer.length);
         assertEquals(0, value);
+        buffer=new byte[]{' ',0};
+        value = TarUtils.parseOctal(buffer,0, buffer.length);
+        assertEquals(0, value);
     }
 
     public void testParseOctalInvalid() throws Exception{
@@ -80,12 +83,6 @@ public class TarUtilsTest extends TestCa
             fail("Expected IllegalArgumentException - should be at least 2 bytes long");
         } catch (IllegalArgumentException expected) {
         }
-        buffer=new byte[]{' ',0,0,0}; // not all NULs
-        try {
-            TarUtils.parseOctal(buffer,0, buffer.length);
-            fail("Expected IllegalArgumentException - not all NULs");
-        } catch (IllegalArgumentException expected) {
-        }
         buffer = "abcdef ".getBytes(CharsetNames.UTF_8); // Invalid input
         try {
             TarUtils.parseOctal(buffer,0, buffer.length);