Closed
Description
Fabian Dankof opened SPR-5897 and commented
HessianException (and subtypes) is not converted to a RemoteAccessConnection if the server responds
with an HTTP 400 error.
In this case, a HessianConnectionException is thrown. It is encapsulated in an InvocationTargetException
but because of missing code, HessianClientInterceptor doesn't handle it and just throws the target exception.
I'd suggest the following:
catch (InvocationTargetException ex) {
if (ex.getTargetException() instanceof HessianRuntimeException) {
HessianRuntimeException hre = (HessianRuntimeException) ex.getTargetException();
Throwable rootCause = (hre.getRootCause() != null ? hre.getRootCause() : hre);
throw convertHessianAccessException(rootCause);
}
else if (ex.getTargetException() instanceof UndeclaredThrowableException) {
UndeclaredThrowableException utex = (UndeclaredThrowableException) ex.getTargetException();
throw convertHessianAccessException(utex.getUndeclaredThrowable());
} else if (ex.getTargetException() instanceof HessianException) {
HessianException hex = (HessianRuntimeException) ex.getTargetException();
// handle / convert HessianException here !!!!!
}
throw ex.getTargetException();
}
Affects: 2.5.6
Referenced from: commits 64bf3b7