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 2012/12/27 22:48:50 UTC

svn commit: r1426338 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java

Author: bodewig
Date: Thu Dec 27 21:48:50 2012
New Revision: 1426338

URL: http://svn.apache.org/viewvc?rev=1426338&view=rev
Log:
COMPRESS-203 actually, the file name must be fixed after it has been truncated

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java?rev=1426338&r1=1426337&r2=1426338&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java Thu Dec 27 21:48:50 2012
@@ -454,14 +454,14 @@ public class TarArchiveOutputStream exte
     void writePaxHeaders(String entryName,
                          Map<String, String> headers) throws IOException {
         String name = "./PaxHeaders.X/" + stripTo7Bits(entryName);
+        if (name.length() >= TarConstants.NAMELEN) {
+            name = name.substring(0, TarConstants.NAMELEN - 1);
+        }
         while (name.endsWith("/")) {
             // TarEntry's constructor would think this is a directory
             // and not allow any data to be written
             name = name.substring(0, name.length() - 1);
         }
-        if (name.length() >= TarConstants.NAMELEN) {
-            name = name.substring(0, TarConstants.NAMELEN - 1);
-        }
         TarArchiveEntry pex = new TarArchiveEntry(name,
                                                   TarConstants.LF_PAX_EXTENDED_HEADER_LC);