[libcommons-compress-java] 02/05: add upstream patch for FTBFS w/Java8

Tony Mancill tmancill at moszumanska.debian.org
Tue Feb 16 04:35:45 GMT 2016


This is an automated email from the git hooks/post-receive script.

tmancill pushed a commit to branch master
in repository libcommons-compress-java.

commit 1f50e99707bff7201f1a268586f8a4324ece058b
Author: tony mancill <tmancill at debian.org>
Date:   Mon Feb 15 20:19:38 2016 -0800

    add upstream patch for FTBFS w/Java8
---
 debian/patches/java8_build.patch | 136 +++++++++++++++++++++++++++++++++++++++
 debian/patches/series            |   1 +
 2 files changed, 137 insertions(+)

diff --git a/debian/patches/java8_build.patch b/debian/patches/java8_build.patch
new file mode 100644
index 0000000..e79069a
--- /dev/null
+++ b/debian/patches/java8_build.patch
@@ -0,0 +1,136 @@
+From a2cda30be14b3da01cbbbedc41b70daf6d88da8b Mon Sep 17 00:00:00 2001
+From: Stefan Bodewig <stefan.bodewig at innoq.com>
+Date: Sat, 24 Oct 2015 08:18:59 +0200
+Subject: [PATCH 1/1] COMPRESS-326 adjust tests to changes in Java's zip
+ package
+
+---
+ .../compress/archivers/zip/ZipArchiveEntry.java    |  8 ++++
+ src/site/xdoc/limitations.xml                      |  4 ++
+ .../archivers/zip/X5455_ExtendedTimestampTest.java | 43 +++++++++++++++-------
+ 4 files changed, 45 insertions(+), 14 deletions(-)
+
+diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
+index 4f66373..13db0ce 100644
+--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
++++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
+@@ -743,6 +743,14 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
+         }
+     }
+ 
++    /**
++     * Wraps {@link ZipEntry#getTime} with a {@link Date} as the
++     * entry's last modified date.
++     *
++     * <p>Changes to the implementation of {@link ZipEntry#getTime}
++     * leak through and the returned value may depend on your local
++     * time zone as well as your version of Java.</p>
++     */
+     public Date getLastModifiedDate() {
+         return new Date(getTime());
+     }
+diff --git a/src/site/xdoc/limitations.xml b/src/site/xdoc/limitations.xml
+index 686951e..851f93e 100644
+--- a/src/site/xdoc/limitations.xml
++++ b/src/site/xdoc/limitations.xml
+@@ -165,6 +165,10 @@
+          of an archive will not be read correctly by
+          <code>ZipArchiveInputStream</code> if it used the STORED
+          method.</li>
++         <li><code>ZipArchiveEntry#getLastModifiedDate</code> uses
++         <code>ZipEntry#getTime</code> under the covers which may
++         return different times for the same archive when using
++         different versions onf Java.</li>
+        </ul>
+      </section>
+    </body>
+diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
+index 4761654..8447669 100644
+--- a/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
++++ b/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
+@@ -100,6 +100,11 @@ public class X5455_ExtendedTimestampTest {
+         1999's zip time:  Jan 1st, 1999-01-01/00:00:02
+         1999's mod time:  Jan 1st, 1999-01-01/00:00:01
+         1999's acc time:  Jan 1st, 1999-01-01/00:00:03
++
++        Starting with a patch release of Java8, "zip time" actually
++        uses the extended time stamp field itself and should be the
++        same as "mod time".
++        http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/90df6756406f
+          */
+ 
+         File archive = getFile("COMPRESS-210_unix_time_zip_test.zip");
+@@ -116,8 +121,10 @@ public class X5455_ExtendedTimestampTest {
+                 ZipArchiveEntry zae = en.nextElement();
+                 String name = zae.getName();
+                 X5455_ExtendedTimestamp xf = (X5455_ExtendedTimestamp) zae.getExtraField(X5455);
+-                Date z = adjustFromGMTToExpectedOffset(zae.getLastModifiedDate());
++                Date rawZ = zae.getLastModifiedDate();
+                 Date m = xf.getModifyJavaTime();
++                boolean zipTimeUsesExtendedTimestamp = rawZ.equals(m);
++                Date z = zipTimeUsesExtendedTimestamp ? rawZ : adjustFromGMTToExpectedOffset(rawZ);
+                 Date a = xf.getAccessJavaTime();
+ 
+                 String zipTime = DATE_FORMAT.format(z);
+@@ -136,24 +143,30 @@ public class X5455_ExtendedTimestampTest {
+                     if (year >= 0) {
+                         switch (year) {
+                             case 2107:
+-                                // Zip time is okay up to 2107.
+-                                assertEquals(year + "-01-01/00:00:02 +0000", zipTime);
++                                if (!zipTimeUsesExtendedTimestamp) {
++                                    // Zip time is okay up to 2107.
++                                    assertEquals(year + "-01-01/00:00:02 +0000", zipTime);
++                                }
+                                 // But the X5455 data has overflowed:
+                                 assertEquals("1970-11-24/17:31:45 +0000", modTime);
+                                 assertEquals("1970-11-24/17:31:47 +0000", accTime);
+                                 break;
+                             case 2108:
+-                                // Zip time is still okay at Jan 1st midnight (UTC) in 2108
+-                                // because we created the zip file in pacific time zone, so it's
+-                                // actually still 2107 in the zip file!
+-                                assertEquals(year + "-01-01/00:00:02 +0000", zipTime);
++                                if (!zipTimeUsesExtendedTimestamp) {
++                                    // Zip time is still okay at Jan 1st midnight (UTC) in 2108
++                                    // because we created the zip file in pacific time zone, so it's
++                                    // actually still 2107 in the zip file!
++                                    assertEquals(year + "-01-01/00:00:02 +0000", zipTime);
++                                }
+                                 // The X5455 data is still overflowed, of course:
+                                 assertEquals("1971-11-24/17:31:45 +0000", modTime);
+                                 assertEquals("1971-11-24/17:31:47 +0000", accTime);
+                                 break;
+                             case 2109:
+                                 // All three timestamps have overflowed by 2109.
+-                                assertEquals("1981-01-01/00:00:02 +0000", zipTime);
++                                if (!zipTimeUsesExtendedTimestamp) {
++                                    assertEquals("1981-01-01/00:00:02 +0000", zipTime);
++                                }
+                                 assertEquals("1972-11-24/17:31:45 +0000", modTime);
+                                 assertEquals("1972-11-24/17:31:47 +0000", accTime);
+ 
+@@ -163,12 +176,14 @@ public class X5455_ExtendedTimestampTest {
+ 
+                                 break;
+                             default:
+-                                // X5455 time is good from epoch (1970) to 2106.
+-                                // Zip time is good from 1980 to 2107.
+-                                if (year < 1980) {
+-                                    assertEquals("1980-01-01/08:00:00 +0000", zipTime);
+-                                } else {
+-                                    assertEquals(year + "-01-01/00:00:02 +0000", zipTime);
++                                if (!zipTimeUsesExtendedTimestamp) {
++                                    // X5455 time is good from epoch (1970) to 2106.
++                                    // Zip time is good from 1980 to 2107.
++                                    if (year < 1980) {
++                                        assertEquals("1980-01-01/08:00:00 +0000", zipTime);
++                                    } else {
++                                        assertEquals(year + "-01-01/00:00:02 +0000", zipTime);
++                                    }
+                                 }
+                                 assertEquals(year + "-01-01/00:00:01 +0000", modTime);
+                                 assertEquals(year + "-01-01/00:00:03 +0000", accTime);
+-- 
+1.9.1
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..79c51b6
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+java8_build.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libcommons-compress-java.git



More information about the pkg-java-commits mailing list