Fixed exception where we fail to forward the cause to the super constructor (FTPSERVER-318)
Deprecated FtpException.getRootCause() as it duplicates Exception.getCause(). Removed ancient handling of the causing exception
git-svn-id: https://svn.apache.org/repos/asf/mina/ftpserver/trunk@817215 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/ftpserver/DataConnectionException.java b/core/src/main/java/org/apache/ftpserver/DataConnectionException.java
index 419bd15..e182c5c 100644
--- a/core/src/main/java/org/apache/ftpserver/DataConnectionException.java
+++ b/core/src/main/java/org/apache/ftpserver/DataConnectionException.java
@@ -66,6 +66,6 @@
* the original cause
*/
public DataConnectionException(final String msg, final Throwable th) {
- super(msg);
+ super(msg, th);
}
}
diff --git a/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/AuthenticationFailedException.java b/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/AuthenticationFailedException.java
index 54ee3e0..d9dc1c7 100644
--- a/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/AuthenticationFailedException.java
+++ b/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/AuthenticationFailedException.java
@@ -65,6 +65,6 @@
* The original cause
*/
public AuthenticationFailedException(String msg, Throwable th) {
- super(msg);
+ super(msg, th);
}
}
diff --git a/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpException.java b/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpException.java
index f5e3d87..67b156e 100644
--- a/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpException.java
+++ b/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpException.java
@@ -19,8 +19,6 @@
package org.apache.ftpserver.ftplet;
-import java.io.PrintStream;
-import java.io.PrintWriter;
/**
* Ftplet exception class.
@@ -31,8 +29,6 @@
private static final long serialVersionUID = -1328383839915898987L;
- private Throwable throwable = null;
-
/**
* Default constructor.
*/
@@ -59,7 +55,6 @@
*/
public FtpException(Throwable th) {
super(th.getMessage());
- throwable = th;
}
/**
@@ -72,47 +67,14 @@
*/
public FtpException(String msg, Throwable th) {
super(msg);
- throwable = th;
}
/**
* Get the root cause.
* @return The root cause
+ * @deprecated Use {@link Exception#getCause()} instead
*/
public Throwable getRootCause() {
- return throwable;
- }
-
- /**
- * Print stack trace.
- */
- public void printStackTrace(PrintWriter pw) {
- if (throwable == null) {
- super.printStackTrace(pw);
- } else {
- throwable.printStackTrace(pw);
- }
- }
-
- /**
- * Print stack trace.
- */
- public void printStackTrace(PrintStream ps) {
- if (throwable == null) {
- super.printStackTrace(ps);
- } else {
- throwable.printStackTrace(ps);
- }
- }
-
- /**
- * Print stack trace.
- */
- public void printStackTrace() {
- if (throwable == null) {
- super.printStackTrace();
- } else {
- throwable.printStackTrace();
- }
+ return getCause();
}
}