commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roxspr...@apache.org
Subject svn commit: r384201 - /jakarta/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/tar/TarBuffer.java
Date Wed, 08 Mar 2006 12:38:22 GMT
Author: roxspring
Date: Wed Mar  8 04:38:21 2006
New Revision: 384201

URL: http://svn.apache.org/viewcvs?rev=384201&view=rev
Log:
Applied Ant fix:
http://svn.apache.org/viewcvs.cgi/ant/core/trunk/src/main/org/apache/tools/tar/TarBuffer.java?rev=277329&r1=276208&r2=277329

For bug:
http://issues.apache.org/bugzilla/show_bug.cgi?id=29877

Modified:
    jakarta/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/tar/TarBuffer.java

Modified: jakarta/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/tar/TarBuffer.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/tar/TarBuffer.java?rev=384201&r1=384200&r2=384201&view=diff
==============================================================================
--- jakarta/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/tar/TarBuffer.java
(original)
+++ jakarta/commons/sandbox/compress/trunk/src/java/org/apache/commons/compress/tar/TarBuffer.java
Wed Mar  8 04:38:21 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002,2004 The Apache Software Foundation.
+ * Copyright 2002,2004,2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Arrays;
 
 /**
  * The TarBuffer class implements the tar archive concept of a buffered input
@@ -438,6 +439,14 @@
             //
             if( numBytes == -1 )
             {
+                // However, just leaving the unread portion of the buffer dirty does
+                // cause problems in some cases.  This problem is described in
+                // http://issues.apache.org/bugzilla/show_bug.cgi?id=29877
+                //
+                // The solution is to fill the unused portion of the buffer with zeros.
+
+                Arrays.fill(m_blockBuffer, offset, offset + bytesNeeded, (byte) 0);
+
                 break;
             }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message