Even shorter impl of getThrowableCount(Throwable) which returns zero
when passed a null argument. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@136978 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e0800963cc
commit
3ad9e1fcc8
|
@ -291,15 +291,10 @@ public static int getThrowableCount(Throwable t)
|
|||
{
|
||||
// Count the number of throwables
|
||||
int count = 0;
|
||||
if (t != null)
|
||||
while (t != null)
|
||||
{
|
||||
count++;
|
||||
t = ExceptionUtils.getCause(t);
|
||||
while (t != null)
|
||||
{
|
||||
count++;
|
||||
t = ExceptionUtils.getCause(t);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue