8130914: java/util/zip/TestExtraTime.java fails with "java.lang.RuntimeException: setTime should make getLastModifiedTime return the specified instant: 3078282244456 got: 3078282244455"

Fixed the 32-bit overflow.

Reviewed-by: rriggs
This commit is contained in:
Xueming Shen 2015-07-22 21:11:38 -07:00
parent 47dbbc7b72
commit 3d82fdcaad
2 changed files with 4 additions and 4 deletions

View File

@ -99,9 +99,9 @@ class ZipUtils {
if (year < 1980) {
return ZipEntry.DOSTIME_BEFORE_1980;
}
return (year - 1980) << 25 | (d.getMonth() + 1) << 21 |
d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 |
d.getSeconds() >> 1;
return ((year - 1980) << 25 | (d.getMonth() + 1) << 21 |
d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 |
d.getSeconds() >> 1) & 0xffffffffL;
}
/**

View File

@ -23,7 +23,7 @@
/**
* @test
* @bug 4759491 6303183 7012868 8015666 8023713 8068790 8076641 8075526
* @bug 4759491 6303183 7012868 8015666 8023713 8068790 8076641 8075526 8130914
* @summary Test ZOS and ZIS timestamp in extra field correctly
*/