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 2023/04/02 15:47:08 UTC

[commons-fileupload] 03/08: Propagate exception cause

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-fileupload.git

commit ae6e9039ba2d2c831fb4ea12638195a43ad02f3f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Apr 2 10:05:08 2023 -0400

    Propagate exception cause
---
 .../fileupload2/pub/FileUploadIOException.java     | 20 +----------------
 .../fileupload2/pub/IOFileUploadException.java     | 26 ++++------------------
 2 files changed, 5 insertions(+), 41 deletions(-)

diff --git a/src/main/java/org/apache/commons/fileupload2/pub/FileUploadIOException.java b/src/main/java/org/apache/commons/fileupload2/pub/FileUploadIOException.java
index 3dc6e6c..cb3d876 100644
--- a/src/main/java/org/apache/commons/fileupload2/pub/FileUploadIOException.java
+++ b/src/main/java/org/apache/commons/fileupload2/pub/FileUploadIOException.java
@@ -31,13 +31,6 @@ public class FileUploadIOException extends IOException {
      */
     private static final long serialVersionUID = -7047616958165584154L;
 
-    /**
-     * The exceptions cause; we overwrite the parent
-     * classes field, which is available since Java
-     * 1.4 only.
-     */
-    private final FileUploadException cause;
-
     /**
      * Creates a {@code FileUploadIOException} with the
      * given cause.
@@ -45,18 +38,7 @@ public class FileUploadIOException extends IOException {
      * @param cause The exceptions cause, if any, or null.
      */
     public FileUploadIOException(final FileUploadException cause) {
-        // We're not doing super(pCause) cause of 1.3 compatibility.
-        this.cause = cause;
-    }
-
-    /**
-     * Returns the exceptions cause.
-     *
-     * @return The exceptions cause, if any, or null.
-     */
-    @Override
-    public Throwable getCause() {
-        return cause;
+        super(cause);
     }
 
 }
diff --git a/src/main/java/org/apache/commons/fileupload2/pub/IOFileUploadException.java b/src/main/java/org/apache/commons/fileupload2/pub/IOFileUploadException.java
index b93566d..9bdc450 100644
--- a/src/main/java/org/apache/commons/fileupload2/pub/IOFileUploadException.java
+++ b/src/main/java/org/apache/commons/fileupload2/pub/IOFileUploadException.java
@@ -30,32 +30,14 @@ public class IOFileUploadException extends FileUploadException {
      */
     private static final long serialVersionUID = 1749796615868477269L;
 
-    /**
-     * The exceptions cause; we overwrite the parent
-     * classes field, which is available since Java
-     * 1.4 only.
-     */
-    private final IOException cause;
-
     /**
      * Creates a new instance with the given cause.
      *
-     * @param pMsg The detail message.
-     * @param pException The exceptions cause.
-     */
-    public IOFileUploadException(final String pMsg, final IOException pException) {
-        super(pMsg);
-        cause = pException;
-    }
-
-    /**
-     * Returns the exceptions cause.
-     *
-     * @return The exceptions cause, if any, or null.
+     * @param message The detail message.
+     * @param cause The exceptions cause.
      */
-    @Override
-    public Throwable getCause() {
-        return cause;
+    public IOFileUploadException(final String message, final IOException cause) {
+        super(message, cause);
     }
 
 }