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


The following commit(s) were added to refs/heads/master by this push:
     new 09cf379d ExecuteException propagates its cause to its IOException 
superclass
09cf379d is described below

commit 09cf379dae0935102904774ae8e9e0914d1c0af5
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Dec 29 10:54:34 2023 -0500

    ExecuteException propagates its cause to its IOException superclass
---
 src/changes/changes.xml                                 |  1 +
 .../java/org/apache/commons/exec/ExecuteException.java  | 17 +----------------
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 3e32581e..a63dce2f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -40,6 +40,7 @@
             <action dev="ggregory" type="fix" due-to="step-security-bot, Gary 
Gregory">[StepSecurity] ci: Harden GitHub Actions #107.</action>
             <action dev="ggregory" type="fix" due-to="Gary Gregory">Port from 
JUnit 4 to 5.</action>
             <action dev="ggregory" type="fix" due-to="ArdenL-Liu, Gary 
Gregory">[Javadoc] CommandLine.toCleanExecutable(final String dirtyExecutable) 
IllegalArgumentException #61.</action>
+            <action dev="ggregory" type="fix" due-to="Gary 
Gregory">ExecuteException propagates its cause to its IOException 
superclass.</action>
             <!-- REMOVE -->
             <action dev="ggregory" type="remove" due-to="Gary 
Gregory">Deprecate DefaultExecuteResultHandler.waitFor(long).</action>
             <action dev="ggregory" type="remove" due-to="Gary 
Gregory">Deprecate ExecuteWatchdog.ExecuteWatchdog(long).</action>
diff --git a/src/main/java/org/apache/commons/exec/ExecuteException.java 
b/src/main/java/org/apache/commons/exec/ExecuteException.java
index 5c39ea96..68331818 100644
--- a/src/main/java/org/apache/commons/exec/ExecuteException.java
+++ b/src/main/java/org/apache/commons/exec/ExecuteException.java
@@ -29,11 +29,6 @@ public class ExecuteException extends IOException {
      */
     private static final long serialVersionUID = 3256443620654331699L;
 
-    /**
-     * The underlying cause of this exception.
-     */
-    private final Throwable cause;
-
     /**
      * The exit value returned by the failed process
      */
@@ -47,7 +42,6 @@ public class ExecuteException extends IOException {
      */
     public ExecuteException(final String message, final int exitValue) {
         super(message + " (Exit value: " + exitValue + ")");
-        this.cause = null;
         this.exitValue = exitValue;
     }
 
@@ -59,19 +53,10 @@ public class ExecuteException extends IOException {
      * @param cause     The underlying cause
      */
     public ExecuteException(final String message, final int exitValue, final 
Throwable cause) {
-        super(message + " (Exit value: " + exitValue + ". Caused by " + cause 
+ ")");
-        this.cause = cause; // Two-argument version requires JDK 1.4 or later
+        super(message + " (Exit value: " + exitValue + ")", cause);
         this.exitValue = exitValue;
     }
 
-    /**
-     * Return the underlying cause of this exception (if any).
-     */
-    @Override
-    public Throwable getCause() {
-        return this.cause;
-    }
-
     /**
      * Gets the exit value returned by the failed process
      *

Reply via email to