--- old/src/java.base/share/classes/java/util/zip/ZipEntry.java 2016-02-15 14:04:53.243644500 -0800 +++ new/src/java.base/share/classes/java/util/zip/ZipEntry.java 2016-02-15 14:04:53.012645523 -0800 @@ -227,12 +227,12 @@ if (year < 0) { this.xdostime = DOSTIME_BEFORE_1980; } else { - this.xdostime = (year << 25 | + this.xdostime = ((year << 25 | time.getMonthValue() << 21 | time.getDayOfMonth() << 16 | time.getHour() << 11 | time.getMinute() << 5 | - time.getSecond() >> 1) + time.getSecond() >> 1) & 0xffffffffL) + ((long)(((time.getSecond() & 0x1) * 1000) + time.getNano() / 1000_000) << 32); } --- old/test/java/util/zip/TestLocalTime.java 2016-02-15 14:04:53.894641613 -0800 +++ new/test/java/util/zip/TestLocalTime.java 2016-02-15 14:04:53.639642743 -0800 @@ -23,7 +23,7 @@ /* * @test - * @bug 8075526 + * @bug 8075526 8135108 * @key intermittent * @summary Test timestamp via ZipEntry.get/setTimeLocal() */ @@ -41,6 +41,7 @@ try { LocalDateTime ldt = LocalDateTime.now(); test(getBytes(ldt), ldt); // now + ldt = ldt.withYear(1968); test(getBytes(ldt), ldt); ldt = ldt.withYear(1970); test(getBytes(ldt), ldt); ldt = ldt.withYear(1982); test(getBytes(ldt), ldt); @@ -55,6 +56,13 @@ testWithTZ(tz, ldt.withYear(2037)); testWithTZ(tz, ldt.withYear(2100)); testWithTZ(tz, ldt.withYear(2106)); + + // for #8135108 + ldt = LocalDateTime.of(2100, 12, 06, 12, 34, 34, 973); + test(getBytes(ldt), ldt); + ldt = LocalDateTime.of(2106, 12, 06, 12, 34, 34, 973); + test(getBytes(ldt), ldt); + } finally { TimeZone.setDefault(tz0); }