You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/11/04 17:19:01 UTC

(commons-compress) branch master updated: Don't use deprecated Java API

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new 17d06432 Don't use deprecated Java API
17d06432 is described below

commit 17d064320eec32ac6fa6581081553e2dd399adaf
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 4 13:18:56 2023 -0400

    Don't use deprecated Java API
---
 .../compress/archivers/zip/X5455_ExtendedTimestampTest.java      | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

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 cb91ce2f..c0d38545 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
@@ -584,11 +584,14 @@ public class X5455_ExtendedTimestampTest {
     @Test
     public void testWriteReadRoundtrip() throws IOException {
         final File output = new File(tmpDir, "write_rewrite.zip");
-        final Date d = new Date(97, 8, 24, 15, 10, 2);
+        final Calendar instance = Calendar.getInstance();
+        instance.clear();
+        instance.set(1997, 8, 24, 15, 10, 2);
+        final Date date = instance.getTime();
         try (final OutputStream out = Files.newOutputStream(output.toPath());
              ZipArchiveOutputStream os = new ZipArchiveOutputStream(out)) {
             final ZipArchiveEntry ze = new ZipArchiveEntry("foo");
-            xf.setModifyJavaTime(d);
+            xf.setModifyJavaTime(date);
             xf.setFlags((byte) 1);
             ze.addExtraField(xf);
             os.putArchiveEntry(ze);
@@ -600,7 +603,7 @@ public class X5455_ExtendedTimestampTest {
             final X5455_ExtendedTimestamp ext = (X5455_ExtendedTimestamp) ze.getExtraField(X5455);
             assertNotNull(ext);
             assertTrue(ext.isBit0_modifyTimePresent());
-            assertEquals(d, ext.getModifyJavaTime());
+            assertEquals(date, ext.getModifyJavaTime());
         }
     }
 }