diff --git a/src/java/org/apache/commons/lang/exception/NestableException.java b/src/java/org/apache/commons/lang/exception/NestableException.java index f126c1799..792f2fac0 100644 --- a/src/java/org/apache/commons/lang/exception/NestableException.java +++ b/src/java/org/apache/commons/lang/exception/NestableException.java @@ -125,7 +125,7 @@ import java.util.StringTokenizer; * @author Daniel Rall * @author Kasper Nielsen * @author Steven Caswell - * @version $Id: NestableException.java,v 1.3 2002/08/25 13:20:59 stevencaswell Exp $ + * @version $Id: NestableException.java,v 1.4 2002/08/25 19:17:31 dlr Exp $ */ public class NestableException extends Exception implements Nestable { @@ -195,31 +195,12 @@ public class NestableException extends Exception implements Nestable public String getMessage() { - StringBuffer msg = new StringBuffer(); - String ourMsg = super.getMessage(); - if (ourMsg != null) - { - msg.append(ourMsg); - } - if (cause != null) - { - String causeMsg = cause.getMessage(); - if (causeMsg != null) - { - if (ourMsg != null) - { - msg.append(": "); - } - msg.append(causeMsg); - } - - } - return (msg.length() > 0 ? msg.toString() : null); + return delegate.getMessage(super.getMessage()); } public String getMessage(int index) { - if(index == 0) + if (index == 0) { return super.getMessage(); } diff --git a/src/java/org/apache/commons/lang/exception/NestableRuntimeException.java b/src/java/org/apache/commons/lang/exception/NestableRuntimeException.java index a1fe90665..f281d4293 100644 --- a/src/java/org/apache/commons/lang/exception/NestableRuntimeException.java +++ b/src/java/org/apache/commons/lang/exception/NestableRuntimeException.java @@ -71,7 +71,7 @@ import java.util.StringTokenizer; * @author Daniel Rall * @author Kasper Nielsen * @author Steven Caswell - * @version $Id: NestableRuntimeException.java,v 1.3 2002/08/25 13:20:59 stevencaswell Exp $ + * @version $Id: NestableRuntimeException.java,v 1.4 2002/08/25 19:15:03 dlr Exp $ */ public class NestableRuntimeException extends RuntimeException implements Nestable @@ -142,31 +142,12 @@ public class NestableRuntimeException extends RuntimeException public String getMessage() { - StringBuffer msg = new StringBuffer(); - String ourMsg = super.getMessage(); - if (ourMsg != null) - { - msg.append(ourMsg); - } - if (cause != null) - { - String causeMsg = cause.getMessage(); - if (causeMsg != null) - { - if (ourMsg != null) - { - msg.append(": "); - } - msg.append(causeMsg); - } - - } - return (msg.length() > 0 ? msg.toString() : null); + return delegate.getMessage(super.getMessage()); } public String getMessage(int index) { - if(index == 0) + if (index == 0) { return super.getMessage(); }