harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r693139 - /harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java
Date Mon, 08 Sep 2008 15:47:03 GMT
Author: sjanuary
Date: Mon Sep  8 08:47:02 2008
New Revision: 693139

URL: http://svn.apache.org/viewvc?rev=693139&view=rev
Log:
Apply patch for HARMONY-5970 ([pack200][classlib] SegmentHeader.archiveModtime is incorrect)

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java?rev=693139&r1=693138&r2=693139&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java
Mon Sep  8 08:47:02 2008
@@ -28,6 +28,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.TimeZone;
 import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 import java.util.zip.GZIPInputStream;
@@ -532,13 +533,20 @@
 
         for (int i = 0; i < numberOfFiles; i++) {
             String name = fileName[i];
-            long modtime = archiveModtime + fileModtime[i];
+            // For Pack200 archives, modtime is in seconds
+            // from the epoch. JarEntries need it to be in
+            // milliseconds from the epoch.
+            // Even though we're adding two longs and multiplying
+            // by 1000, we won't overflow because both longs are
+            // always under 2^32.
+            long modtime = 1000 * (archiveModtime + fileModtime[i]);
             boolean deflate = fileDeflate[i];
 
             JarEntry entry = new JarEntry(name);
             if (deflate)
                 entry.setMethod(ZipEntry.DEFLATED);
-            entry.setTime(modtime);
+            // On Windows at least, need to correct for timezone
+            entry.setTime(modtime - TimeZone.getDefault().getRawOffset());
             out.putNextEntry(entry);
 
             if (fileIsClass[i]) {



Mime
View raw message