JDK-8068790 : ZipEntry/JarEntry.setCreation/LastAccessTime(null) don't throw NPE as specified
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2015-01-12
  • Updated: 2016-08-24
  • Resolved: 2015-02-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u60Fixed 9 b53Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
(This is a tck-red/conformance clone of JDK-8065536)

Spec for the methods
http://docs.oracle.com/javase/8/docs/api/java/util/zip/ZipEntry.html#setCreationTime-java.nio.file.attribute.FileTime-
http://docs.oracle.com/javase/8/docs/api/java/util/zip/ZipEntry.html#setLastAccessTime-java.nio.file.attribute.FileTime-

says:

"Throws:
NullPointerException - if the time is null"


However the implementation doesn't satisfy this assertion, the following code will produce no exceptions:

        new ZipEntry("entry").setCreationTime(null);
        new ZipEntry("entry").setLastAccessTime(null);
        new JarEntry("entry").setCreationTime(null);
        new JarEntry("entry").setLastAccessTime(null);


The following JCK9 tests will fail due to this:

api/java_util/jar/JarEntry/autd2.html#CreationTime[nullCreationTime]
api/java_util/jar/JarEntry/autd2.html#LastAccessTime[nullCreationTime]
api/java_util/zip/ZipEntry/autd2.html#LastAccessTime[nullCreationTime]
api/java_util/zip/ZipEntry/autd2.html#CreationTime[nullCreationTime]