o Improved getThrowableCount(Throwable) to return zero when passed a
null argument. o Added @param JavaDoc for methods added during last commit. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@136976 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c5a3bf5fc1
commit
90b54cc01b
|
@ -284,17 +284,22 @@ private static Throwable getCauseUsingFieldName(Throwable t,
|
|||
* Returns the number of <code>Throwable</code> objects in the
|
||||
* exception chain.
|
||||
*
|
||||
* @param t The exception to inspect.
|
||||
* @return The throwable count.
|
||||
*/
|
||||
public static int getThrowableCount(Throwable t)
|
||||
{
|
||||
// Count the number of throwables
|
||||
int count = 1;
|
||||
t = ExceptionUtils.getCause(t);
|
||||
while (t != null)
|
||||
int count = 0;
|
||||
if (t != null)
|
||||
{
|
||||
count++;
|
||||
t = ExceptionUtils.getCause(t);
|
||||
while (t != null)
|
||||
{
|
||||
count++;
|
||||
t = ExceptionUtils.getCause(t);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
@ -303,6 +308,7 @@ public static int getThrowableCount(Throwable t)
|
|||
* Returns the list of <code>Throwable</code> objects in the
|
||||
* exception chain.
|
||||
*
|
||||
* @param t The exception to inspect.
|
||||
* @return The list of <code>Throwable</code> objects.
|
||||
*/
|
||||
public static Throwable[] getThrowables(Throwable t)
|
||||
|
@ -339,6 +345,7 @@ public static int indexOfThrowable(Throwable t, Class type)
|
|||
* greater than or equal to the specified index, or
|
||||
* <code>-1</code> if the type is not found.
|
||||
*
|
||||
* @param t The exception to inspect.
|
||||
* @param type <code>Class</code> to look for.
|
||||
* @param fromIndex The (zero based) index of the starting
|
||||
* position in the chain to be searched.
|
||||
|
|
Loading…
Reference in New Issue