Skip to content

HessianException is not converted to RemoteAccessConnection on HTTP 400 [SPR-5897] #10566

Closed
@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions