You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/04/25 14:23:33 UTC
(commons-compress) 03/10: DumpArchiveException now extends ArchiveException instead of IOException (ArchiveException extends IOException)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 9592c977a1981d8ce1c67ddb30adae05a6197988
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Fri Apr 25 09:04:18 2025 -0400
DumpArchiveException now extends ArchiveException instead of IOException
(ArchiveException extends IOException)
- Add ArchiveException.ArchiveException(String, Throwable)
- Add ArchiveException.ArchiveException(Throwable)
---
src/changes/changes.xml | 3 ++
.../apache/commons/compress/CompressException.java | 17 +++++++++++
.../compress/archivers/ArchiveException.java | 34 ++++++++++++++++++++++
.../archivers/dump/DumpArchiveException.java | 4 +--
4 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 20bc9456f..f0e23bcfa 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -89,6 +89,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="Alexis Jehan, Gary Gregory">org.apache.commons.compress.harmony.unpack200.Archive.unpack() should not log to system out (the console).</action>
<action type="fix" dev="Sebb" due-to="aSemy">[site] Fix minor zip docs type: remove extraneous 'a' #665.</action>
<action type="fix" dev="ggregory" due-to="Zaki, Gary Gregory">Throw a better exception in org.apache.commons.compress.archivers.sevenz.SevenZFile.readFilesInfo(ByteBuffer, Archive).</action>
+ <action type="fix" dev="ggregory" due-to="Gary Gregory">DumpArchiveException now extends ArchiveException instead of IOException (ArchiveException extends IOException).</action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">Add GzipParameters.getModificationInstant().</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add GzipParameters.setModificationInstant(Instant).</action>
@@ -120,6 +121,8 @@ The <action> type attribute can be add,update,fix,remove.
<action type="add" dev="ggregory" due-to="Gary Gregory, David Walluck, Piotr P. Karwasz">Add org.apache.commons.compress.compressors.xz.ZstdConstants #666.</action>
<action type="add" dev="ggregory" due-to="Gary Gregory, Zaki">Add org.apache.commons.compress.archivers.ArchiveException.requireNonNull(T, Supplier<String>).</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add org.apache.commons.compress.compressors.CompressorException as the root for all custom exceptions ArchiveException and CompressorException.</action>
+ <action type="add" dev="ggregory" due-to="Gary Gregory">Add ArchiveException.ArchiveException(String, Throwable).</action>
+ <action type="add" dev="ggregory" due-to="Gary Gregory">Add ArchiveException.ArchiveException(Throwable).</action>
<!-- UPDATE -->
<action type="update" dev="sebb">Bump Commons Parent from 79 to 81</action>
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump org.apache.commons:commons-parent from 72 to 79 #563, #567, #574, #582, #587, #595.</action>
diff --git a/src/main/java/org/apache/commons/compress/CompressException.java b/src/main/java/org/apache/commons/compress/CompressException.java
index b2821c91d..2ae933edb 100644
--- a/src/main/java/org/apache/commons/compress/CompressException.java
+++ b/src/main/java/org/apache/commons/compress/CompressException.java
@@ -56,6 +56,13 @@ protected static <T, E extends Throwable> T requireNonNull(final Class<? super E
return obj;
}
+ /**
+ * Constructs an {@code CompressException} with {@code null} as its error detail message.
+ */
+ public CompressException() {
+ // empty
+ }
+
/**
* Constructs a new exception with the specified detail message. The cause is not initialized.
*
@@ -75,4 +82,14 @@ public CompressException(final String message) {
public CompressException(final String message, final Throwable cause) {
super(message, cause);
}
+
+ /**
+ * Constructs a {@code CompressException} with the specified cause and a detail message.
+ *
+ * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). (A null value is permitted, and indicates that the cause
+ * is nonexistent or unknown.)
+ */
+ public CompressException(final Throwable cause) {
+ super(cause);
+ }
}
diff --git a/src/main/java/org/apache/commons/compress/archivers/ArchiveException.java b/src/main/java/org/apache/commons/compress/archivers/ArchiveException.java
index b04998ab1..3258aac82 100644
--- a/src/main/java/org/apache/commons/compress/archivers/ArchiveException.java
+++ b/src/main/java/org/apache/commons/compress/archivers/ArchiveException.java
@@ -44,6 +44,15 @@ public static <T> T requireNonNull(final T obj, final Supplier<String> messageSu
return CompressException.requireNonNull(ArchiveException.class, obj, messageSupplier);
}
+ /**
+ * Constructs an {@code ArchiveException} with {@code null} as its error detail message.
+ *
+ * @since 1.28.0
+ */
+ public ArchiveException() {
+ // empty
+ }
+
/**
* Constructs a new exception with the specified detail message. The cause is not initialized.
*
@@ -59,8 +68,33 @@ public ArchiveException(final String message) {
* @param message The message (which is saved for later retrieval by the {@link #getMessage()} method).
* @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). A null value indicates that the cause is nonexistent or
* unknown.
+ * @deprecated Use {@link #ArchiveException(String, Throwable)}.
*/
+ @Deprecated
public ArchiveException(final String message, final Exception cause) {
super(message, cause);
}
+
+ /**
+ * Constructs a new exception with the specified detail message and cause.
+ *
+ * @param message The message (which is saved for later retrieval by the {@link #getMessage()} method).
+ * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). A null value indicates that the cause is nonexistent or
+ * unknown.
+ * @since 1.28.0
+ */
+ public ArchiveException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a {@code ArchiveException} with the specified cause and a detail message.
+ *
+ * @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method). (A null value is permitted, and indicates that the cause
+ * is nonexistent or unknown.)
+ * @since 1.28.0
+ */
+ public ArchiveException(final Throwable cause) {
+ super(cause);
+ }
}
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveException.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveException.java
index a908be7d8..cdac1941b 100644
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveException.java
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveException.java
@@ -19,12 +19,12 @@
package org.apache.commons.compress.archivers.dump;
-import java.io.IOException;
+import org.apache.commons.compress.archivers.ArchiveException;
/**
* Signals that an dump archive exception of some sort has occurred.
*/
-public class DumpArchiveException extends IOException {
+public class DumpArchiveException extends ArchiveException {
private static final long serialVersionUID = 1L;