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
|
* Returns the number of <code>Throwable</code> objects in the
|
||||||
* exception chain.
|
* exception chain.
|
||||||
*
|
*
|
||||||
|
* @param t The exception to inspect.
|
||||||
* @return The throwable count.
|
* @return The throwable count.
|
||||||
*/
|
*/
|
||||||
public static int getThrowableCount(Throwable t)
|
public static int getThrowableCount(Throwable t)
|
||||||
{
|
{
|
||||||
// Count the number of throwables
|
// Count the number of throwables
|
||||||
int count = 1;
|
int count = 0;
|
||||||
t = ExceptionUtils.getCause(t);
|
if (t != null)
|
||||||
while (t != null)
|
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
t = ExceptionUtils.getCause(t);
|
t = ExceptionUtils.getCause(t);
|
||||||
|
while (t != null)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
t = ExceptionUtils.getCause(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -303,6 +308,7 @@ public static int getThrowableCount(Throwable t)
|
||||||
* Returns the list of <code>Throwable</code> objects in the
|
* Returns the list of <code>Throwable</code> objects in the
|
||||||
* exception chain.
|
* exception chain.
|
||||||
*
|
*
|
||||||
|
* @param t The exception to inspect.
|
||||||
* @return The list of <code>Throwable</code> objects.
|
* @return The list of <code>Throwable</code> objects.
|
||||||
*/
|
*/
|
||||||
public static Throwable[] getThrowables(Throwable t)
|
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
|
* greater than or equal to the specified index, or
|
||||||
* <code>-1</code> if the type is not found.
|
* <code>-1</code> if the type is not found.
|
||||||
*
|
*
|
||||||
|
* @param t The exception to inspect.
|
||||||
* @param type <code>Class</code> to look for.
|
* @param type <code>Class</code> to look for.
|
||||||
* @param fromIndex The (zero based) index of the starting
|
* @param fromIndex The (zero based) index of the starting
|
||||||
* position in the chain to be searched.
|
* position in the chain to be searched.
|
||||||
|
|
Loading…
Reference in New Issue