Author: adrianc
Date: Sun Apr 26 11:36:49 2015
New Revision: 1676098
URL: http://svn.apache.org/r1676098
Log:
Code simplification in StartupException.java - remove custom code that
duplicates functionality that already exists in super class Throwable.
Modified:
ofbiz/trunk/framework/start/src/org/ofbiz/base/start/StartupException.java
Modified:
ofbiz/trunk/framework/start/src/org/ofbiz/base/start/StartupException.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/org/ofbiz/base/start/StartupException.java?rev=1676098&r1=1676097&r2=1676098&view=diff
==============================================================================
--- ofbiz/trunk/framework/start/src/org/ofbiz/base/start/StartupException.java
(original)
+++ ofbiz/trunk/framework/start/src/org/ofbiz/base/start/StartupException.java
Sun Apr 26 11:36:49 2015
@@ -18,9 +18,6 @@
*******************************************************************************/
package org.ofbiz.base.start;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
/**
* StartupException
*
@@ -28,8 +25,6 @@ import java.io.PrintWriter;
@SuppressWarnings("serial")
public class StartupException extends Exception {
- Throwable nested = null;
-
/**
* Creates new <code>StartupException</code> without detail message.
*/
@@ -51,8 +46,7 @@ public class StartupException extends Ex
* @param nested the chained exception.
*/
public StartupException(String msg, Throwable nested) {
- super(msg);
- this.nested = nested;
+ super(msg, nested);
}
/**
@@ -60,15 +54,14 @@ public class StartupException extends Ex
* @param nested the chained exception.
*/
public StartupException(Throwable nested) {
- super();
- this.nested = nested;
+ super(nested);
}
/** Returns the detail message, including the message from the nested
exception if there is one. */
@Override
public String getMessage() {
- if (nested != null) {
- return super.getMessage() + " (" + nested.getMessage() + ")";
+ if (getCause() != null) {
+ return super.getMessage() + " (" + getCause().getMessage() + ")";
} else {
return super.getMessage();
}
@@ -78,39 +71,4 @@ public class StartupException extends Ex
public String getNonNestedMessage() {
return super.getMessage();
}
-
- /** Returns the nested exception if there is one, null if there is not. */
- public Throwable getNested() {
- if (nested == null) {
- return this;
- }
- return nested;
- }
-
- /** Prints the composite message to System.err. */
- @Override
- public void printStackTrace() {
- super.printStackTrace();
- if (nested != null) {
- nested.printStackTrace();
- }
- }
-
- /** Prints the composite message and the embedded stack trace to the
specified stream ps. */
- @Override
- public void printStackTrace(PrintStream ps) {
- super.printStackTrace(ps);
- if (nested != null) {
- nested.printStackTrace(ps);
- }
- }
-
- /** Prints the composite message and the embedded stack trace to the
specified print writer pw. */
- @Override
- public void printStackTrace(PrintWriter pw) {
- super.printStackTrace(pw);
- if (nested != null) {
- nested.printStackTrace(pw);
- }
- }
}