-
CSR
-
Resolution: Approved
-
P4
-
None
-
behavioral
-
minimal
-
-
Other
-
SE
Summary
Clarify the javadoc for ZipFile::getInputStream and JarFile::getInputStream to indicate that null is returned for the InputStream if the specified ZipEntry does not exist within the Jar/Zip file
Problem
The javadoc never defined the behavior when the specified Zip/JarEntry does not exist in the Zip/Jar
Solution
Clarify the javadoc to indicate the longstanding behavior
Specification
The javadoc for ZipFile::getInputStream and JarFile::getInputStream will be modified to indicate a null will be returned when the ZipEntry does not exist within the Jar/Zip file:
cat ZipDiffs.txt
diff --git a/src/java.base/share/classes/java/util/jar/JarFile.java b/src/java.base/share/classes/java/util/jar/JarFile.java
index 050e93aa48b..b014c18f466 100644
--- a/src/java.base/share/classes/java/util/jar/JarFile.java
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java
@@ -826,7 +826,8 @@ public class JarFile extends ZipFile {
* zip file entry.
* @param ze the zip file entry
* @return an input stream for reading the contents of the specified
- * zip file entry
+ * zip file entry or null if the zip file entry does not exist
+ * within the jar file
* @throws ZipException if a zip file format error has occurred
* @throws IOException if an I/O error has occurred
* @throws SecurityException if any of the jar file entries
diff --git a/src/java.base/share/classes/java/util/zip/ZipFile.java b/src/java.base/share/classes/java/util/zip/ZipFile.java
index a3c38acef91..1bef27986a3 100644
--- a/src/java.base/share/classes/java/util/zip/ZipFile.java
+++ b/src/java.base/share/classes/java/util/zip/ZipFile.java
@@ -345,7 +345,8 @@ public class ZipFile implements ZipConstants, Closeable {
*
* @param entry the zip file entry
* @return the input stream for reading the contents of the specified
- * zip file entry.
+ * zip file entry or null if the zip file entry does not exist
+ * within the zip file.
* @throws ZipException if a ZIP format error has occurred
* @throws IOException if an I/O error has occurred
* @throws IllegalStateException if the zip file has been closed
- csr of
-
JDK-8280409 JarFile::getInputStream can fail with NPE accessing ze.getName()
-
- Resolved
-