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/06/23 19:29:04 UTC

[commons-jelly] 01/05: [core] Throw a specialized RuntimeException instead of RuntimeException

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

commit 35d30f4782e93b9c66881d0303ee6495a6f85cfc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 15:08:23 2023 -0400

    [core] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../commons/jelly/util/NestedRuntimeException.java | 31 +++-------------------
 1 file changed, 4 insertions(+), 27 deletions(-)

diff --git a/core/src/main/java/org/apache/commons/jelly/util/NestedRuntimeException.java b/core/src/main/java/org/apache/commons/jelly/util/NestedRuntimeException.java
index c03db9cb..85f2defa 100644
--- a/core/src/main/java/org/apache/commons/jelly/util/NestedRuntimeException.java
+++ b/core/src/main/java/org/apache/commons/jelly/util/NestedRuntimeException.java
@@ -35,16 +35,11 @@ import java.io.PrintWriter;
  * </pre>
  *
  * @author James Strachan
+ * @deprecated Use {@link RuntimeException}.
  */
-
+@Deprecated
 public class NestedRuntimeException extends RuntimeException {
 
-    /**
-     * Holds the reference to the exception or error that caused
-     * this exception to be thrown.
-     */
-    private Throwable cause = null;
-
     /**
      * Constructs a new <code>NestedRuntimeException</code> with specified
      * nested <code>Throwable</code>.
@@ -53,8 +48,7 @@ public class NestedRuntimeException extends RuntimeException {
      * thrown
      */
     public NestedRuntimeException(Throwable cause) {
-        super(cause.getMessage());
-        this.cause = cause;
+        super(cause);
     }
 
     /**
@@ -66,24 +60,7 @@ public class NestedRuntimeException extends RuntimeException {
      * thrown
      */
     public NestedRuntimeException(String msg, Throwable cause) {
-        super(msg);
-        this.cause = cause;
-    }
-
-    public Throwable getCause() {
-        return cause;
-    }
-
-    public void printStackTrace() {
-        cause.printStackTrace();
-    }
-
-    public void printStackTrace(PrintStream out) {
-        cause.printStackTrace(out);
-    }
-
-    public void printStackTrace(PrintWriter out) {
-        cause.printStackTrace(out);
+        super(msg, cause);
     }
 
 }