added printStackTrace(PrintStream) method to NonThrowableNestable static class to satisfy Nestable interface;

removed deprecated getLength() and indexOfThrowable(int,Class) methods from static test classes;
revised javadocs fof static test classes to be more accurate in describing method behavior


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137037 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steven Caswell 2002-09-18 15:51:41 +00:00
parent 8bce2df421
commit 593e15d717

View File

@ -65,7 +65,7 @@
* *
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a> * @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a> * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
* @version $Id: NestableDelegateTestCase.java,v 1.2 2002/07/26 20:30:58 stevencaswell Exp $ * @version $Id: NestableDelegateTestCase.java,v 1.3 2002/09/18 15:51:41 stevencaswell Exp $
*/ */
public class NestableDelegateTestCase extends junit.framework.TestCase public class NestableDelegateTestCase extends junit.framework.TestCase
{ {
@ -545,12 +545,8 @@ public NestableDelegateTester1(Throwable cause)
} }
/** /**
* Returns the error message of this and any nested <code>Throwable</code>s * @see Nestable#getThrowables()
* in an array of Strings, one element for each message. Any * Returns zero-length <code>Throwable</code> array for this test.
* <code>Throwable</code> specified without a message is represented in
* the array by a null.
*
* @return the <code>Throwable</code>s
*/ */
public Throwable[] getThrowables() public Throwable[] getThrowables()
{ {
@ -558,12 +554,8 @@ public Throwable[] getThrowables()
} }
/** /**
* Returns the error message of this and any nested <code>Throwable</code>s * @see Nestable#getMessages()
* in an array of Strings, one element for each message. Any * Returns zero-length String array for this test.
* <code>Throwable</code> specified without a message is represented in
* the array by a null.
*
* @return the error messages
*/ */
public String[] getMessages() public String[] getMessages()
{ {
@ -571,16 +563,8 @@ public String[] getMessages()
} }
/** /**
* Returns the index, numbered from 0, of the first occurrence of the * @see Nestable#indexOfThrowable(Class)
* specified type in the chain of <code>Throwable</code>s, or -1 if the * Returns -1 for this test.
* specified type is not found in the chain. If <code>pos</code> is
* negative, the effect is the same as if it were 0. If <code>pos</code>
* is greater than or equal to the length of the chain, the effect is the
* same as if it were the index of the last element in the chain.
*
* @param type <code>Class</code> to be found
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
*/ */
public int indexOfThrowable(Class type) public int indexOfThrowable(Class type)
{ {
@ -588,15 +572,8 @@ public int indexOfThrowable(Class type)
} }
/** /**
* Returns the <code>Throwable</code> in the chain of * @see Nestable#getThrowable(int)
* <code>Throwable</code>s at the specified index, numbererd from 0. If * Returns <code>null</code> for this test.
* <code>index</code> is negative, the effect is the same as if it
* were 0. If <code>index</code> is greater than or equal to the length
* of the chain, the last <code>Throwable</code> in the chain is returned.
*
* @param index the index of the <code>Throwable</code> in the chain of
* <code>Throwable</code>s
* @return the <code>Throwable</code>
*/ */
public Throwable getThrowable(int index) public Throwable getThrowable(int index)
{ {
@ -604,8 +581,8 @@ public Throwable getThrowable(int index)
} }
/** /**
* Returns the number of nested <code>Throwable</code>s represented by * @see Nestable#getThrowableCount()
* this <code>Nestable</code>, including this <code>Nestable</code>. * Returns 1 for this test.
*/ */
public int getThrowableCount() public int getThrowableCount()
{ {
@ -613,8 +590,7 @@ public int getThrowableCount()
} }
/** /**
* Returns the reference to the exception or error that caused the * @see Nestable#getCause()
* exception implementing the <code>Nestable</code> to be thrown.
*/ */
public Throwable getCause() public Throwable getCause()
{ {
@ -622,12 +598,8 @@ public Throwable getCause()
} }
/** /**
* Prints the stack trace for this exception only--root cause not * Empty method to satisfy the implemented interface. Does nothing
* included--using the provided writer. Used by {@link * in this test.
* org.apache.commons.lang.exception.NestableDelegate} to write
* individual stack traces to a buffer. The implementation of
* this method should call
* <code>super.printStackTrace(out);</code> in most cases.
* *
* @param out The writer to use. * @param out The writer to use.
*/ */
@ -636,16 +608,7 @@ public void printPartialStackTrace(PrintWriter out)
} }
/** /**
* Returns the error message of the <code>Throwable</code> in the chain * @see Nestable#getMessage(int)
* of <code>Throwable</code>s at the specified index, numbererd from 0.
* If <code>index</code> is negative, the effect is the same as if it
* were 0. If <code>index</code> is greater than or equal to the length
* of the chain, the message of the last <code>Throwable</code> in the
* chain is returned.
*
* @param index the index of the <code>Throwable</code> in the chain of
* <code>Throwable</code>s
* @return the error message
*/ */
public String getMessage(int index) public String getMessage(int index)
{ {
@ -660,56 +623,14 @@ public String getMessage(int index)
} }
/** /**
* Returns the index, numbered from 0, of the first <code>Throwable</code> * @see Nestable#indexOfThrowable(Class, int)
* that matches the specified type in the chain of <code>Throwable</code>s * Returns -1 for this test.
* with an index greater than or equal to the specified position, or -1 if
* the type is not found. If <code>pos</code> is negative, the effect is the
* same as if it were 0. If <code>pos</code> is greater than or equal to the
* length of the chain, the effect is the same as if it were the index of
* the last element in the chain.
*
* @param type <code>Class</code> to be found
* @param pos index, numbered from 0, of the starting position in the chain
* to be searched
*
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
*/ */
public int indexOfThrowable(Class type, int fromIndex) public int indexOfThrowable(Class type, int fromIndex)
{ {
return -1; return -1;
} }
/** Returns the number of nested <code>Throwable</code>s represented by
* this <code>Nestable</code>, including this <code>Nestable</code>.
* @deprecated
*/
public int getLength()
{
return 1;
}
/** Returns the index, numbered from 0, of the first <code>Throwable</code>
* that matches the specified type in the chain of <code>Throwable</code>s
* with an index greater than or equal to the specified position, or -1 if
* the type is not found. If <code>pos</code> is negative, the effect is the
* same as if it were 0. If <code>pos</code> is greater than or equal to the
* length of the chain, the effect is the same as if it were the index of
* the last element in the chain.
*
* @param pos index, numbered from 0, of the starting position in the chain
* to be searched
* @param type <code>Class</code> to be found
*
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
* @deprecated replaced by {@link #indexOfThrowable(Class, int)}
*/
public int indexOfThrowable(int pos, Class type)
{
return -1;
}
} }
class NestableDelegateTester2 extends Throwable implements Nestable class NestableDelegateTester2 extends Throwable implements Nestable
@ -739,12 +660,8 @@ public NestableDelegateTester2(Throwable cause)
} }
/** /**
* Returns the error message of this and any nested <code>Throwable</code>s * @see Nestable#getThrowables()
* in an array of Strings, one element for each message. Any * Returns zero-length <code>Throwable</code> array for this test.
* <code>Throwable</code> specified without a message is represented in
* the array by a null.
*
* @return the <code>Throwable</code>s
*/ */
public Throwable[] getThrowables() public Throwable[] getThrowables()
{ {
@ -752,12 +669,8 @@ public Throwable[] getThrowables()
} }
/** /**
* Returns the error message of this and any nested <code>Throwable</code>s * @see Nestable#getMessages()
* in an array of Strings, one element for each message. Any * Returns zero-length String array for this test.
* <code>Throwable</code> specified without a message is represented in
* the array by a null.
*
* @return the error messages
*/ */
public String[] getMessages() public String[] getMessages()
{ {
@ -765,16 +678,8 @@ public String[] getMessages()
} }
/** /**
* Returns the index, numbered from 0, of the first occurrence of the * @see Nestable#indexOfThrowable(Class)
* specified type in the chain of <code>Throwable</code>s, or -1 if the * Returns -1 for this test.
* specified type is not found in the chain. If <code>pos</code> is
* negative, the effect is the same as if it were 0. If <code>pos</code>
* is greater than or equal to the length of the chain, the effect is the
* same as if it were the index of the last element in the chain.
*
* @param type <code>Class</code> to be found
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
*/ */
public int indexOfThrowable(Class type) public int indexOfThrowable(Class type)
{ {
@ -782,15 +687,8 @@ public int indexOfThrowable(Class type)
} }
/** /**
* Returns the <code>Throwable</code> in the chain of * @see Nestable#getThrowable(int)
* <code>Throwable</code>s at the specified index, numbererd from 0. If * Returns <code>null</code> for this test.
* <code>index</code> is negative, the effect is the same as if it
* were 0. If <code>index</code> is greater than or equal to the length
* of the chain, the last <code>Throwable</code> in the chain is returned.
*
* @param index the index of the <code>Throwable</code> in the chain of
* <code>Throwable</code>s
* @return the <code>Throwable</code>
*/ */
public Throwable getThrowable(int index) public Throwable getThrowable(int index)
{ {
@ -798,8 +696,10 @@ public Throwable getThrowable(int index)
} }
/** /**
* Returns the number of nested <code>Throwable</code>s represented by * @see Nestable#getThrowableCount()
* this <code>Nestable</code>, including this <code>Nestable</code>. * Returns 1 for this test.
*
* @return 1
*/ */
public int getThrowableCount() public int getThrowableCount()
{ {
@ -807,8 +707,7 @@ public int getThrowableCount()
} }
/** /**
* Returns the reference to the exception or error that caused the * @see Nestable#getCause()
* exception implementing the <code>Nestable</code> to be thrown.
*/ */
public Throwable getCause() public Throwable getCause()
{ {
@ -816,12 +715,8 @@ public Throwable getCause()
} }
/** /**
* Prints the stack trace for this exception only--root cause not * Empty method to satisfy the implemented interface. Does nothing
* included--using the provided writer. Used by {@link * in this test.
* org.apache.commons.lang.exception.NestableDelegate} to write
* individual stack traces to a buffer. The implementation of
* this method should call
* <code>super.printStackTrace(out);</code> in most cases.
* *
* @param out The writer to use. * @param out The writer to use.
*/ */
@ -830,16 +725,7 @@ public void printPartialStackTrace(PrintWriter out)
} }
/** /**
* Returns the error message of the <code>Throwable</code> in the chain * @see Nestable#getMessage(int)
* of <code>Throwable</code>s at the specified index, numbererd from 0.
* If <code>index</code> is negative, the effect is the same as if it
* were 0. If <code>index</code> is greater than or equal to the length
* of the chain, the message of the last <code>Throwable</code> in the
* chain is returned.
*
* @param index the index of the <code>Throwable</code> in the chain of
* <code>Throwable</code>s
* @return the error message
*/ */
public String getMessage(int index) public String getMessage(int index)
{ {
@ -854,56 +740,14 @@ public String getMessage(int index)
} }
/** /**
* Returns the index, numbered from 0, of the first <code>Throwable</code> * @see Nestable#indexOfThrowable(Class, int)
* that matches the specified type in the chain of <code>Throwable</code>s * Returns -1 for this test.
* with an index greater than or equal to the specified position, or -1 if
* the type is not found. If <code>pos</code> is negative, the effect is the
* same as if it were 0. If <code>pos</code> is greater than or equal to the
* length of the chain, the effect is the same as if it were the index of
* the last element in the chain.
*
* @param type <code>Class</code> to be found
* @param pos index, numbered from 0, of the starting position in the chain
* to be searched
*
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
*/ */
public int indexOfThrowable(Class type, int fromIndex) public int indexOfThrowable(Class type, int fromIndex)
{ {
return -1; return -1;
} }
/** Returns the number of nested <code>Throwable</code>s represented by
* this <code>Nestable</code>, including this <code>Nestable</code>.
* @deprecated
*/
public int getLength()
{
return 1;
}
/** Returns the index, numbered from 0, of the first <code>Throwable</code>
* that matches the specified type in the chain of <code>Throwable</code>s
* with an index greater than or equal to the specified position, or -1 if
* the type is not found. If <code>pos</code> is negative, the effect is the
* same as if it were 0. If <code>pos</code> is greater than or equal to the
* length of the chain, the effect is the same as if it were the index of
* the last element in the chain.
*
* @param pos index, numbered from 0, of the starting position in the chain
* to be searched
* @param type <code>Class</code> to be found
*
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
* @deprecated replaced by {@link #indexOfThrowable(Class, int)}
*/
public int indexOfThrowable(int pos, Class type)
{
return -1;
}
} }
class ThrowableNestable extends Throwable implements Nestable class ThrowableNestable extends Throwable implements Nestable
@ -911,8 +755,8 @@ class ThrowableNestable extends Throwable implements Nestable
private Throwable cause = new Exception("ThrowableNestable cause"); private Throwable cause = new Exception("ThrowableNestable cause");
/** /**
* Returns the number of nested <code>Throwable</code>s represented by * @see Nestable#getThrowableCount()
* this <code>Nestable</code>, including this <code>Nestable</code>. * Returns 1 for this test.
*/ */
public int getThrowableCount() public int getThrowableCount()
{ {
@ -920,10 +764,9 @@ public int getThrowableCount()
} }
/** /**
* Returns the error message of this and any nested * @see Nestable#getMessage()
* <code>Throwable</code>. * Returns the hard-coded string "ThrowableNestable exception" for this
* * test.
* @return The error message.
*/ */
public String getMessage() public String getMessage()
{ {
@ -931,16 +774,9 @@ public String getMessage()
} }
/** /**
* Returns the error message of the <code>Throwable</code> in the chain * @see Nestable#getMessage(int)
* of <code>Throwable</code>s at the specified index, numbererd from 0. * Returns the hard-coded string "ThrowableNestable exception" for this
* If <code>index</code> is negative, the effect is the same as if it * test.
* were 0. If <code>index</code> is greater than or equal to the length
* of the chain, the message of the last <code>Throwable</code> in the
* chain is returned.
*
* @param index the index of the <code>Throwable</code> in the chain of
* <code>Throwable</code>s
* @return the error message
*/ */
public String getMessage(int index) public String getMessage(int index)
{ {
@ -948,10 +784,8 @@ public String getMessage(int index)
} }
/** /**
* Returns the error message of this and any nested <code>Throwable</code>s * @see Nestable#getMessages()
* in an array of Strings, one element for each message. Any * Returns single-element string array with "ThrowableNestable exception".
* <code>Throwable</code> specified without a message is represented in
* the array by a null.
*/ */
public String[] getMessages() public String[] getMessages()
{ {
@ -961,8 +795,7 @@ public String[] getMessages()
} }
/** /**
* Returns the reference to the exception or error that caused the * @see Nestable#getCause()
* exception implementing the <code>Nestable</code> to be thrown.
*/ */
public Throwable getCause() public Throwable getCause()
{ {
@ -970,35 +803,34 @@ public Throwable getCause()
} }
/** /**
* Prints the stack trace of this exception to the specified print * @see Nestable#printStackTrace(PrintWriter)
* writer. Includes inforamation from the exception--if * Empty method to satisfy the implemented interface. Does nothing
* any--which caused this exception. * in this test.
*
* @param out <code>PrintWriter</code> to use for output.
*/ */
public void printStackTrace(PrintWriter out) public void printStackTrace(PrintWriter out)
{ {
} }
/** /**
* Prints the stack trace for this exception only--root cause not * @see Nestable#printPartialStackTrace(PrintWriter)
* included--using the provided writer. Used by {@link * Empty method to satisfy the implemented interface. Does nothing
* org.apache.commons.lang.exception.NestableDelegate} to write * in this test.
* individual stack traces to a buffer. The implementation of
* this method should call
* <code>super.printStackTrace(out);</code> in most cases.
*
* @param out The writer to use.
*/ */
public void printPartialStackTrace(PrintWriter out) public void printPartialStackTrace(PrintWriter out)
{ {
} }
/**
* @see Nestable#getThrowable(int)
*/
public Throwable getThrowable(int index) public Throwable getThrowable(int index)
{ {
return cause; return cause;
} }
/**
* @see Nestable#getThrowables()
*/
public Throwable[] getThrowables() public Throwable[] getThrowables()
{ {
Throwable throwables[] = new Throwable[1]; Throwable throwables[] = new Throwable[1];
@ -1006,6 +838,9 @@ public Throwable[] getThrowables()
return throwables; return throwables;
} }
/**
* @see Nestable#indexOfThrowable(Class)
*/
public int indexOfThrowable(Class type) public int indexOfThrowable(Class type)
{ {
if(Exception.class.isInstance(type)) if(Exception.class.isInstance(type))
@ -1016,50 +851,13 @@ public int indexOfThrowable(Class type)
} }
/** /**
* Returns the index of the first <code>Throwable</code> that matches the * @see Nestable#indexOfThrowable(Class,int)
* specified type with an index greater than or equal to the specified
* position, or -1 if the type is not found.
*
* @param type <code>Class</code> to be found
* @param pos
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
*/ */
public int indexOfThrowable(Class type, int fromIndex) public int indexOfThrowable(Class type, int fromIndex)
{ {
return indexOfThrowable(type); return indexOfThrowable(type);
} }
/** Returns the number of nested <code>Throwable</code>s represented by
* this <code>Nestable</code>, including this <code>Nestable</code>.
* @deprecated
*/
public int getLength()
{
return 1;
}
/** Returns the index, numbered from 0, of the first <code>Throwable</code>
* that matches the specified type in the chain of <code>Throwable</code>s
* with an index greater than or equal to the specified position, or -1 if
* the type is not found. If <code>pos</code> is negative, the effect is the
* same as if it were 0. If <code>pos</code> is greater than or equal to the
* length of the chain, the effect is the same as if it were the index of
* the last element in the chain.
*
* @param pos index, numbered from 0, of the starting position in the chain
* to be searched
* @param type <code>Class</code> to be found
*
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
* @deprecated replaced by {@link #indexOfThrowable(Class, int)}
*/
public int indexOfThrowable(int pos, Class type)
{
return indexOfThrowable(type);
}
} }
class ThrowableNestedNestable extends Throwable implements Nestable class ThrowableNestedNestable extends Throwable implements Nestable
@ -1071,32 +869,40 @@ public ThrowableNestedNestable(Throwable cause)
this.cause = cause; this.cause = cause;
} }
/**
* @see Nestable#getThrowableCount()
* Returns 1 for this test.
*/
public int getThrowableCount() public int getThrowableCount()
{ {
return 1; return 1;
} }
/** /**
* Returns the error message of this and any nested * @see Nestable#getMessage()
* <code>Throwable</code>. * For this test, returns "ThrowableNestable exception (" appended to the
* * message of the cause specified in the constructor.
* @return The error message.
*/ */
public String getMessage() public String getMessage()
{ {
return "ThrowableNestedNestable exception (" + cause.getMessage() + ")"; return "ThrowableNestedNestable exception (" + cause.getMessage() + ")";
} }
/**
* @see Nestable#getMessage(int)
* For this test, returns "ThrowableNestable exception (" appended to the
* message of the cause specified in the constructor.
*/
public String getMessage(int index) public String getMessage(int index)
{ {
return "ThrowableNestedNestable exception (" + cause.getMessage() + ")"; return "ThrowableNestedNestable exception (" + cause.getMessage() + ")";
} }
/** /**
* Returns the error message of this and any nested <code>Throwable</code>s * @see Nestable#getMessages()
* in an array of Strings, one element for each message. Any * For this test, returns a single-element string array containing
* <code>Throwable</code> specified without a message is represented in * "ThrowableNestable exception (" appended to the
* the array by a null. * message of the cause specified in the constructor.
*/ */
public String[] getMessages() public String[] getMessages()
{ {
@ -1106,8 +912,7 @@ public String[] getMessages()
} }
/** /**
* Returns the reference to the exception or error that caused the * @see Nestable#getCause()
* exception implementing the <code>Nestable</code> to be thrown.
*/ */
public Throwable getCause() public Throwable getCause()
{ {
@ -1115,11 +920,9 @@ public Throwable getCause()
} }
/** /**
* Prints the stack trace of this exception to the specified print * @see Nestable#printStackTrace(PrintWriter)
* writer. Includes inforamation from the exception--if * For this test, writes the string
* any--which caused this exception. * "ThrowableNestedNestable stack trace place-holder" to the print writer.
*
* @param out <code>PrintWriter</code> to use for output.
*/ */
public void printStackTrace(PrintWriter out) public void printStackTrace(PrintWriter out)
{ {
@ -1127,25 +930,27 @@ public void printStackTrace(PrintWriter out)
} }
/** /**
* Prints the stack trace for this exception only--root cause not * @see Nestable#printPartialStackTrace(PrintWriter)
* included--using the provided writer. Used by {@link * For this test, writes the string
* org.apache.commons.lang.exception.NestableDelegate} to write * "ThrowableNestedNestable partial stack trace place-holder" to the print
* individual stack traces to a buffer. The implementation of * writer.
* this method should call
* <code>super.printStackTrace(out);</code> in most cases.
*
* @param out The writer to use.
*/ */
public void printPartialStackTrace(PrintWriter out) public void printPartialStackTrace(PrintWriter out)
{ {
out.println("ThrowableNestedNestable partial stack trace place-holder"); out.println("ThrowableNestedNestable partial stack trace place-holder");
} }
/**
* @see Nestable#getThrowable(int)
*/
public Throwable getThrowable(int index) public Throwable getThrowable(int index)
{ {
return cause; return cause;
} }
/**
* @see Nestable#getThrowableS()
*/
public Throwable[] getThrowables() public Throwable[] getThrowables()
{ {
Throwable throwables[] = new Throwable[1]; Throwable throwables[] = new Throwable[1];
@ -1153,6 +958,9 @@ public Throwable[] getThrowables()
return throwables; return throwables;
} }
/**
* @see Nestable#indexOfThrowable(Class)
*/
public int indexOfThrowable(Class type) public int indexOfThrowable(Class type)
{ {
if(Exception.class.isInstance(type)) if(Exception.class.isInstance(type))
@ -1163,80 +971,48 @@ public int indexOfThrowable(Class type)
} }
/** /**
* Returns the index of the first <code>Throwable</code> that matches the * @see Nestable#indexOfThrowable(Class, int)
* specified type with an index greater than or equal to the specified
* position, or -1 if the type is not found.
*
* @param type <code>Class</code> to be found
* @param pos
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
*/ */
public int indexOfThrowable(Class type, int fromIndex) public int indexOfThrowable(Class type, int fromIndex)
{ {
return indexOfThrowable(type); return indexOfThrowable(type);
} }
/** Returns the number of nested <code>Throwable</code>s represented by
* this <code>Nestable</code>, including this <code>Nestable</code>.
* @deprecated
*/
public int getLength()
{
return 1;
}
/** Returns the index, numbered from 0, of the first <code>Throwable</code>
* that matches the specified type in the chain of <code>Throwable</code>s
* with an index greater than or equal to the specified position, or -1 if
* the type is not found. If <code>pos</code> is negative, the effect is the
* same as if it were 0. If <code>pos</code> is greater than or equal to the
* length of the chain, the effect is the same as if it were the index of
* the last element in the chain.
*
* @param pos index, numbered from 0, of the starting position in the chain
* to be searched
* @param type <code>Class</code> to be found
*
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
* @deprecated replaced by {@link #indexOfThrowable(Class, int)}
*/
public int indexOfThrowable(int pos, Class type)
{
return indexOfThrowable(type);
}
} }
class NonThrowableNestable implements Nestable class NonThrowableNestable implements Nestable
{ {
/**
* @see Nestable#getThrowableCount()
* Returns 1 for this test.
*/
public int getThrowableCount() public int getThrowableCount()
{ {
return 1; return 1;
} }
/** /**
* Returns the error message of this and any nested * @see Nestable#getMessage()
* <code>Throwable</code>. * Returns the string "non-throwable" for this test.
*
* @return The error message.
*/ */
public String getMessage() public String getMessage()
{ {
return "non-throwable"; return "non-throwable";
} }
/**
* @see Nestable#getMessage(int)
* Returns the string "non-throwable" for this test.
*/
public String getMessage(int index) public String getMessage(int index)
{ {
return "non-throwable"; return "non-throwable";
} }
/** /**
* Returns the error message of this and any nested <code>Throwable</code>s * @see Nestable#getMessage()
* in an array of Strings, one element for each message. Any * Returns a single-element array containing the string "non-throwable" for
* <code>Throwable</code> specified without a message is represented in * this test.
* the array by a null.
*/ */
public String[] getMessages() public String[] getMessages()
{ {
@ -1246,8 +1022,8 @@ public String[] getMessages()
} }
/** /**
* Returns the reference to the exception or error that caused the * @see Nestable#getCause()
* exception implementing the <code>Nestable</code> to be thrown. * Returns <code>null</code> for this test.
*/ */
public Throwable getCause() public Throwable getCause()
{ {
@ -1255,88 +1031,67 @@ public Throwable getCause()
} }
/** /**
* Prints the stack trace of this exception to the specified print * @see Nestable#printStackTrace(PrintWriter)
* writer. Includes inforamation from the exception--if * Empty method to satisfy the implemented interface. Does nothing
* any--which caused this exception. * in this test.
*
* @param out <code>PrintWriter</code> to use for output.
*/ */
public void printStackTrace(PrintWriter out) public void printStackTrace(PrintWriter out)
{ {
} }
/** /**
* Prints the stack trace for this exception only--root cause not * @see Nestable#printStackTrace(PrintStream)
* included--using the provided writer. Used by {@link * Empty method to satisfy the implemented interface. Does nothing
* org.apache.commons.lang.exception.NestableDelegate} to write * in this test.
* individual stack traces to a buffer. The implementation of */
* this method should call public void printStackTrace(PrintStream out)
* <code>super.printStackTrace(out);</code> in most cases. {
* }
* @param out The writer to use.
/**
* @see Nestable#printPartialStackTrace(PrintWriter)
* Empty method to satisfy the implemented interface. Does nothing
* in this test.
*/ */
public void printPartialStackTrace(PrintWriter out) public void printPartialStackTrace(PrintWriter out)
{ {
} }
/**
* @see Nestable#getThrowable(int)
* Returns <code>null</code> for this test.
*/
public Throwable getThrowable(int index) public Throwable getThrowable(int index)
{ {
return null; return null;
} }
/**
* @see Nestable#getThrowables()
* Returns zero-length <code>Throwable</code> array.
*/
public Throwable[] getThrowables() public Throwable[] getThrowables()
{ {
return new Throwable[0]; return new Throwable[0];
} }
/**
* @see Nestable#indexOfThrowable(Class)
* Returns -1 for this test.
*/
public int indexOfThrowable(Class type) public int indexOfThrowable(Class type)
{ {
return -1; return -1;
} }
/** /**
* Returns the index of the first <code>Throwable</code> that matches the * @see Nestable#indexOfThrowable(Class, int)
* specified type with an index greater than or equal to the specified * Returns -1 for this test.
* position, or -1 if the type is not found.
*
* @param type <code>Class</code> to be found
* @param pos
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
*/ */
public int indexOfThrowable(Class type, int fromIndex) public int indexOfThrowable(Class type, int fromIndex)
{ {
return -1; return -1;
} }
/** Returns the number of nested <code>Throwable</code>s represented by
* this <code>Nestable</code>, including this <code>Nestable</code>.
* @deprecated
*/
public int getLength()
{
return 1;
}
/** Returns the index, numbered from 0, of the first <code>Throwable</code>
* that matches the specified type in the chain of <code>Throwable</code>s
* with an index greater than or equal to the specified position, or -1 if
* the type is not found. If <code>pos</code> is negative, the effect is the
* same as if it were 0. If <code>pos</code> is greater than or equal to the
* length of the chain, the effect is the same as if it were the index of
* the last element in the chain.
*
* @param pos index, numbered from 0, of the starting position in the chain
* to be searched
* @param type <code>Class</code> to be found
*
* @return index of the first occurrence of the type in the chain, or -1 if
* the type is not found
* @deprecated replaced by {@link #indexOfThrowable(Class, int)}
*/
public int indexOfThrowable(int pos, Class type)
{
return -1;
}
} }