560 |
|
Class<?>[] ps = c.getParameterTypes(); |
561 |
|
if (ps.length == 0) |
562 |
|
noArgCtor = c; |
563 |
< |
else if (ps.length == 1 && ps[0] == Throwable.class) |
564 |
< |
return (Throwable)(c.newInstance(ex)); |
563 |
> |
else if (ps.length == 1 && ps[0] == Throwable.class) { |
564 |
> |
Throwable wx = (Throwable)c.newInstance(ex); |
565 |
> |
return (wx == null) ? ex : wx; |
566 |
> |
} |
567 |
|
} |
568 |
|
if (noArgCtor != null) { |
569 |
|
Throwable wx = (Throwable)(noArgCtor.newInstance()); |
570 |
< |
wx.initCause(ex); |
571 |
< |
return wx; |
570 |
> |
if (wx != null) { |
571 |
> |
wx.initCause(ex); |
572 |
> |
return wx; |
573 |
> |
} |
574 |
|
} |
575 |
|
} catch (Exception ignore) { |
576 |
|
} |