commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1529665 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
Date Sun, 06 Oct 2013 18:46:45 GMT
Author: bodewig
Date: Sun Oct  6 18:46:45 2013
New Revision: 1529665

URL: http://svn.apache.org/r1529665
Log:
arj stores date in seconds since epoch on Unix

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java?rev=1529665&r1=1529664&r2=1529665&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
Sun Oct  6 18:46:45 2013
@@ -58,8 +58,9 @@ public class ArjArchiveEntry implements 
     }
 
     public Date getLastModifiedDate() {
-        return new Date(ZipUtil.dosToJavaTime(
-                0xffffFFFFL & localFileHeader.dateTimeModified));
+        long ts = isHostOsUnix() ? (localFileHeader.dateTimeModified * 1000l)
+            : ZipUtil.dosToJavaTime(0xFFFFFFFFL & localFileHeader.dateTimeModified);
+        return new Date(ts);
     }
 
     /**
@@ -77,7 +78,7 @@ public class ArjArchiveEntry implements 
      * <p>Will only be non-zero of the host os was UNIX.
      */
     public int getUnixMode() {
-        return getHostOs() == HostOs.UNIX ? getMode() : 0;
+        return isHostOsUnix() ? getMode() : 0;
     }
 
     /**
@@ -89,6 +90,14 @@ public class ArjArchiveEntry implements 
     }
 
     /**
+     * Is the operating system the archive has been created on one
+     * that is considered a UNIX OS by arj?
+     */
+    public boolean isHostOsUnix() {
+        return getHostOs() == HostOs.UNIX || getHostOs() == HostOs.NEXT;
+    }
+
+    /**
      * The known values for HostOs.
      */
     public static class HostOs {



Mime
View raw message