You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2013/10/27 19:12:58 UTC

svn commit: r1536171 - /ant/core/trunk/src/main/org/apache/tools/zip/ZipUtil.java

Author: bodewig
Date: Sun Oct 27 18:12:58 2013
New Revision: 1536171

URL: http://svn.apache.org/r1536171
Log:
explicitly set milliseconds to 0 when parsing ZipEntry's time field, it has two second granularity anyway

Modified:
    ant/core/trunk/src/main/org/apache/tools/zip/ZipUtil.java

Modified: ant/core/trunk/src/main/org/apache/tools/zip/ZipUtil.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/zip/ZipUtil.java?rev=1536171&r1=1536170&r2=1536171&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/zip/ZipUtil.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/zip/ZipUtil.java Sun Oct 27 18:12:58 2013
@@ -107,6 +107,7 @@ public abstract class ZipUtil {
         cal.set(Calendar.HOUR_OF_DAY, (int) (dosTime >> 11) & 0x1f);
         cal.set(Calendar.MINUTE, (int) (dosTime >> 5) & 0x3f);
         cal.set(Calendar.SECOND, (int) (dosTime << 1) & 0x3e);
+        cal.set(Calendar.MILLISECOND, 0);
         // CheckStyle:MagicNumberCheck ON
         return cal.getTime().getTime();
     }
@@ -228,4 +229,4 @@ public abstract class ZipUtil {
                                                    .Feature.METHOD, ze);
         }
     }
-}
\ No newline at end of file
+}



Re: svn commit: r1536171 - /ant/core/trunk/src/main/org/apache/tools/zip/ZipUtil.java

Posted by Stefan Bodewig <bo...@apache.org>.
On 2013-10-27, <bo...@apache.org> wrote:

> URL: http://svn.apache.org/r1536171
> Log:
> explicitly set milliseconds to 0 when parsing ZipEntry's time field, it has two second granularity anyway

this is another JDK8 issue.  java.util.zip.ZipEntry setTime or getTime
seems to be rounding up to the next even second now, while it used to
round down.  This patch avoids the rounding.

Stefan

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