commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [3/6] commons-compress git commit: COMPRESS-416 cosmetics
Date Tue, 04 Jul 2017 08:56:46 GMT
COMPRESS-416 cosmetics


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/8251cd68
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/8251cd68
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/8251cd68

Branch: refs/heads/master
Commit: 8251cd68f4db4bd56d88646e10d34ef4a1fdf90f
Parents: cd1d329
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Tue Jul 4 08:54:24 2017 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Tue Jul 4 08:56:00 2017 +0200

----------------------------------------------------------------------
 .../archivers/zip/X5455_ExtendedTimestamp.java  | 22 ++++++++++----------
 .../zip/X5455_ExtendedTimestampTest.java        |  9 ++++----
 2 files changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8251cd68/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
index f050874..28590c2 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
@@ -385,10 +385,6 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable,
Serial
         return zipLongToDate(accessTime);
     }
 
-    private static Date zipLongToDate(ZipLong unixTime) {
-        return unixTime != null ? new Date(unixTime.getIntValue() * 1000L) : null;
-    }
-
     /**
      * <p>
      * Returns the create time as a a java.util.Date
@@ -525,13 +521,6 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable,
Serial
         return unixTimeToZipLong(d.getTime() / 1000);
     }
 
-    private static ZipLong unixTimeToZipLong(long l) {
-        if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) {
-            throw new IllegalArgumentException("X5455 timestamps must fit in a signed 32
bit integer: " + l);
-        }
-        return new ZipLong(l);
-    }
-
     /**
      * Returns a String representation of this class useful for
      * debugging purposes.
@@ -596,4 +585,15 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable,
Serial
         return hc;
     }
 
+    private static Date zipLongToDate(ZipLong unixTime) {
+        return unixTime != null ? new Date(unixTime.getIntValue() * 1000L) : null;
+    }
+
+    private static ZipLong unixTimeToZipLong(long l) {
+        if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) {
+            throw new IllegalArgumentException("X5455 timestamps must fit in a signed 32
bit integer: " + l);
+        }
+        return new ZipLong(l);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/8251cd68/src/test/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestampTest.java
----------------------------------------------------------------------
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 a0d9666..40db766 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
@@ -151,10 +151,11 @@ public class X5455_ExtendedTimestampTest {
                                     } else {
                                         assertEquals(year + "-01-01/00:00:02 +0000", zipTime);
                                     }
-                                }if(year <2038) {
-                                assertEquals(year + "-01-01/00:00:01 +0000", modTime);
-                                assertEquals(year + "-01-01/00:00:03 +0000", accTime);
-                            }
+                                }
+                                if (year < 2038) {
+                                    assertEquals(year + "-01-01/00:00:01 +0000", modTime);
+                                    assertEquals(year + "-01-01/00:00:03 +0000", accTime);
+                                }
                                 break;
                         }
                     }


Mime
View raw message