Leveraged NestableDelegate.getMessage(String).

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@136990 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Rall 2002-08-25 19:17:31 +00:00
parent 33457071e9
commit 1f075abae4
2 changed files with 6 additions and 44 deletions

View File

@ -125,7 +125,7 @@ import java.util.StringTokenizer;
* @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
* @author <a href="mailto:knielsen@apache.org">Kasper Nielsen</a>
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
* @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();
}

View File

@ -71,7 +71,7 @@ import java.util.StringTokenizer;
* @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
* @author <a href="mailto:knielsen@apache.org">Kasper Nielsen</a>
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
* @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();
}