commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r760837 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar: ArArchiveEntry.java ArArchiveInputStream.java
Date Wed, 01 Apr 2009 10:09:05 GMT
Author: sebb
Date: Wed Apr  1 10:09:01 2009
New Revision: 760837

URL: http://svn.apache.org/viewvc?rev=760837&view=rev
Log:
SVR4/GNU adds trailing / to filename entries.
Go figure.

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java?rev=760837&r1=760836&r2=760837&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveEntry.java
Wed Apr  1 10:09:01 2009
@@ -35,6 +35,11 @@
     /** The trailer for each entry */
     public static final String TRAILER = "`\012";
     
+    /**
+     * SVR4/GNU adds a trailing / to names; BSD does not.
+     * They also vary in how names longer than 16 characters are represented.
+     * (Not yet supported by this implementation)
+     */
     private final String name;
 	private final int userId;
 	private final int groupId;

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java?rev=760837&r1=760836&r2=760837&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
Wed Apr  1 10:09:01 2009
@@ -126,7 +126,13 @@
         }
 
         entryOffset = offset;
-        currentEntry = new ArArchiveEntry(new String(name).trim(),
+        
+        // SVR4/GNU adds a trailing "/" to names
+        String temp=new String(name).trim();
+        if (temp.endsWith("/")){
+            temp=temp.substring(0, temp.length()-1);
+        }
+        currentEntry = new ArArchiveEntry(temp,
                                           Long.parseLong(new String(length)
                                                          .trim()));
         return currentEntry;



Mime
View raw message