Renamed "cause" private field to "nestable" to better reflect what it

is.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@136989 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Rall 2002-08-25 19:09:38 +00:00
parent 241e24c4d6
commit 33457071e9
1 changed files with 16 additions and 15 deletions

View File

@ -65,7 +65,7 @@
* @author <a href="mailto:dlr@collab.net">Daniel Rall</a> * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
* @author <a href="mailto:knielsen@apache.org">Kasper Nielsen</a> * @author <a href="mailto:knielsen@apache.org">Kasper Nielsen</a>
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a> * @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
* @version $Id: NestableDelegate.java,v 1.7 2002/08/25 19:02:49 dlr Exp $ * @version $Id: NestableDelegate.java,v 1.8 2002/08/25 19:09:38 dlr Exp $
*/ */
public class NestableDelegate public class NestableDelegate
{ {
@ -77,23 +77,24 @@ public class NestableDelegate
+ "constructor must extend java.lang.Throwable"; + "constructor must extend java.lang.Throwable";
/** /**
* Holds the reference to the exception or error that caused this * Holds the reference to the exception or error that we're
* exception to be thrown. * wrapping (which must be a {@link
* org.apache.commons.lang.exception.Nestable} implementation).
*/ */
private Throwable cause = null; private Throwable nestable = null;
/** /**
* Constructs a new <code>NestableDelegate</code> instance to manage the * Constructs a new <code>NestableDelegate</code> instance to manage the
* specified <code>Nestable</code>. * specified <code>Nestable</code>.
* *
* @param cause the Nestable implementation (<i>must</i> extend * @param nestable the Nestable implementation (<i>must</i> extend
* {@link java.lang.Throwable}) * {@link java.lang.Throwable})
*/ */
NestableDelegate(Nestable cause) // package NestableDelegate(Nestable nestable) // package
{ {
if (cause instanceof Throwable) if (nestable instanceof Throwable)
{ {
this.cause = (Throwable) cause; this.nestable = (Throwable) nestable;
} }
else else
{ {
@ -146,7 +147,7 @@ String getMessage(String baseMsg) // package
msg.append(baseMsg); msg.append(baseMsg);
} }
Throwable nestedCause = ExceptionUtils.getCause(this.cause); Throwable nestedCause = ExceptionUtils.getCause(this.nestable);
if (nestedCause != null) if (nestedCause != null)
{ {
String causeMsg = nestedCause.getMessage(); String causeMsg = nestedCause.getMessage();
@ -201,7 +202,7 @@ Throwable getThrowable(int index)
{ {
if(index == 0) if(index == 0)
{ {
return this.cause; return this.nestable;
} }
Throwable[] throwables = this.getThrowables(); Throwable[] throwables = this.getThrowables();
return throwables[index]; return throwables[index];
@ -215,7 +216,7 @@ Throwable getThrowable(int index)
*/ */
int getThrowableCount() // package int getThrowableCount() // package
{ {
return ExceptionUtils.getThrowableCount(this.cause); return ExceptionUtils.getThrowableCount(this.nestable);
} }
/** /**
@ -227,7 +228,7 @@ int getThrowableCount() // package
*/ */
Throwable[] getThrowables() // package Throwable[] getThrowables() // package
{ {
return ExceptionUtils.getThrowables(this.cause); return ExceptionUtils.getThrowables(this.nestable);
} }
/** /**
@ -247,7 +248,7 @@ Throwable[] getThrowables() // package
*/ */
int indexOfThrowable(Class type, int fromIndex) // package int indexOfThrowable(Class type, int fromIndex) // package
{ {
return ExceptionUtils.indexOfThrowable(this.cause, type, fromIndex); return ExceptionUtils.indexOfThrowable(this.nestable, type, fromIndex);
} }
/** /**
@ -287,8 +288,8 @@ public void printStackTrace(PrintWriter out)
{ {
synchronized (out) synchronized (out)
{ {
String[] st = getStackFrames(this.cause); String[] st = getStackFrames(this.nestable);
Throwable nestedCause = ExceptionUtils.getCause(this.cause); Throwable nestedCause = ExceptionUtils.getCause(this.nestable);
if (nestedCause != null) if (nestedCause != null)
{ {
if (nestedCause instanceof Nestable) if (nestedCause instanceof Nestable)