543 |
|
if (e == null || (ex = e.ex) == null) |
544 |
|
return null; |
545 |
|
if (e.thrower != Thread.currentThread().getId()) { |
546 |
– |
Class<? extends Throwable> ec = ex.getClass(); |
546 |
|
try { |
547 |
|
Constructor<?> noArgCtor = null; |
548 |
< |
Constructor<?>[] cs = ec.getConstructors();// public ctors only |
549 |
< |
for (int i = 0; i < cs.length; ++i) { |
551 |
< |
Constructor<?> c = cs[i]; |
548 |
> |
// public ctors only |
549 |
> |
for (Constructor<?> c : ex.getClass().getConstructors()) { |
550 |
|
Class<?>[] ps = c.getParameterTypes(); |
551 |
|
if (ps.length == 0) |
552 |
|
noArgCtor = c; |
553 |
< |
else if (ps.length == 1 && ps[0] == Throwable.class) { |
554 |
< |
Throwable wx = (Throwable)c.newInstance(ex); |
557 |
< |
return (wx == null) ? ex : wx; |
558 |
< |
} |
553 |
> |
else if (ps.length == 1 && ps[0] == Throwable.class) |
554 |
> |
return (Throwable)c.newInstance(ex); |
555 |
|
} |
556 |
|
if (noArgCtor != null) { |
557 |
< |
Throwable wx = (Throwable)(noArgCtor.newInstance()); |
558 |
< |
if (wx != null) { |
559 |
< |
wx.initCause(ex); |
564 |
< |
return wx; |
565 |
< |
} |
557 |
> |
Throwable wx = (Throwable)noArgCtor.newInstance(); |
558 |
> |
wx.initCause(ex); |
559 |
> |
return wx; |
560 |
|
} |
561 |
|
} catch (Exception ignore) { |
562 |
|
} |