Closed
Description
Cyril Dejonghe opened BATCH-2479 and commented
I'm facing a case where unwrapIfRethrown() returns null (initial exception with no cause) :
/**
* Unwraps the throwable if it has been wrapped by
* {@link #rethrow(Throwable)}.
*/
private static Throwable unwrapIfRethrown(Throwable throwable) {
if (throwable instanceof RepeatException) {
return throwable.getCause();
}
else {
return throwable;
}
}
This causes doHandle() to fail :
private void doHandle(Throwable throwable, RepeatContext context, Collection<Throwable> deferred) {
// An exception alone is not sufficient grounds for not continuing
Throwable unwrappedThrowable = unwrapIfRethrown(throwable);
try {
...
if (logger.isDebugEnabled()) {
logger.debug("Handling exception: " + throwable.getClass().getName() + ", caused by: " + unwrappedThrowable.getClass().getName() + ": " + unwrappedThrowable.getMessage());
}
exceptionHandler.handleException(context, unwrappedThrowable);
} catch (Throwable handled) {
deferred.add(handled);
}
}
The cause seem pretty clear : calling unwrappedThrowable.getClass().getName() + ": " + unwrappedThrowable.getMessage() on a null object ...
Affects: 3.0.6