-
CSR
-
Resolution: Approved
-
P4
-
None
-
source
-
low
-
A corpus search on GitHub and Maven shows only a handful of usages of this class. The Java SE API specification never documented that ZipError was thrown by ZipFile or any other API, which significantly reduces the risk.
-
Java API
-
SE
Summary
Deprecate for removal the class java.util.zip.ZipError
.
Problem
ZipError
was introduced via JDK-4615343 in JDK 6 and extends java.lang.InternalError
to maintain compatibiliy with any existing client code catching InternalError
.
Its usage was removed from ZipFile
in JDK 9 when the use of native code transitioned to Java via JDK-8142508. The only other use was in the original ZipFS
demo which also was removed when ZipFS was integrated into JDK 9 as a supported Module. The JDK never documented in any API specification that ZipError
was thrown.
The ZipError class is easy to confuse with similarly named ZipException
class in the same package. It is not suitable for general-purpose ZIP exceptions as it extends InternalError, yet there is no warning against its usage.
A corpus search on GitHub and Maven showed only a handful of uses.
Solution
Mark the class java.util.zip.ZipError
as deprecated, for removal.
Affected client code should be updated to catch or throw ZipException
. Code base needing to catch ZipError
on JDK 8 should catch the super class InternalError
instead.
This specification change will be accompanied by a Release Note in the release it is approved for.
Specification
diff --git a/src/java.base/share/classes/java/util/zip/ZipError.java b/src/java.base/share/classes/java/util/zip/ZipError.java
index 2aa37bef010..933cc447091 100644
--- a/src/java.base/share/classes/java/util/zip/ZipError.java
+++ b/src/java.base/share/classes/java/util/zip/ZipError.java
@@ -28,9 +28,12 @@
/**
* Signals that an unrecoverable error has occurred.
*
+ * @deprecated ZipError is no longer used and is obsolete.
+ * {@link ZipException} should be used instead.
* @author Dave Bristor
* @since 1.6
*/
+@Deprecated(since="24", forRemoval = true)
public class ZipError extends InternalError {
@java.io.Serial
private static final long serialVersionUID = 853973422266861979L;
- csr of
-
JDK-8336843 Deprecate java.util.zip.ZipError for removal
- Resolved