Repository: commons-compress Updated Branches: refs/heads/master 5481dd326 -> 992911d0f
[COMPRESS-416] Tests failing under jdk 9 : one reflection issue, one change to ZipEntry related issue. Example failure from Simon in JIRA, turned into a standalone test by me. Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/992911d0 Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/992911d0 Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/992911d0 Branch: refs/heads/master Commit: 992911d0fcd230497ee3fc50dcf49042b7372a47 Parents: 5481dd3 Author: Simon Spero <[email protected]> Authored: Mon Jul 3 09:49:41 2017 -0700 Committer: Gary Gregory <[email protected]> Committed: Mon Jul 3 09:49:41 2017 -0700 ---------------------------------------------------------------------- .../archivers/zip/Java9ZipEntryTimeTest.java | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-compress/blob/992911d0/src/test/java/org/apache/commons/compress/archivers/zip/Java9ZipEntryTimeTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/Java9ZipEntryTimeTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/Java9ZipEntryTimeTest.java new file mode 100644 index 0000000..d5a641b --- /dev/null +++ b/src/test/java/org/apache/commons/compress/archivers/zip/Java9ZipEntryTimeTest.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.commons.compress.archivers.zip; + +import java.io.File; +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; +import java.util.zip.ZipEntry; + +import org.junit.Assert; +import org.junit.Test; + +public class Java9ZipEntryTimeTest { + + /** + * Fails on Java 9. + * + * @throws Exception + */ + @Test + public void testJUZTimes() throws Exception { + final File archive = new File("src/test/resources/COMPRESS-210_unix_time_zip_test.zip"); + try (java.util.zip.ZipFile zf = new java.util.zip.ZipFile(archive)) { + final ZipEntry entry = zf.getEntry("COMPRESS-210_unix_time_zip_test/2105"); + final Calendar girl = Calendar.getInstance(TimeZone.getTimeZone("GMT")); + girl.setTime(new Date(entry.getTime())); + final int year = girl.get(Calendar.YEAR); + Assert.assertEquals(2105, year); + } + } +}
