Affects: Spring Framework Web 6.1.8
I use the ReactorNettyClientRequestFactory
within RestTemplate
and RestClient
.
RestTemplate
and RestClient
take care of mapping IOException
s to ResourceAccessException
s.
In case of using the reactor.netty.http.client.HttpClient
, ReactorNettyClientRequest
, ReactorNettyClientResponse
-
RuntimeException
s like IllegalStateException
(caused by .block()
calls), io.netty.handler.timeout.ReadTimeoutException
etc. bubble thru - up to RestTemplate
and RestClient
consumers which should only know the RessoureAccessException
s.
So most likely IOException
s should be thrown in ReactorNettyClientRequest
, ReactorNettyClientResponse
methods.
Furthermore the behaviour is not consistent with other ClientHttpRequestFactory
implementations
like JettyClientHttpRequestFactory
, OkClientHttpRequestFactory
, ...
Comment From: jhoeller
A revision will be available in the upcoming 6.1.9 snapshot, consistently converting to IOExceptions. Feel free to give it an early try!
Comment From: helmut-hackl-dynatrace
big thanks! i will give it a try ...
Comment From: helmut-hackl-dynatrace
I patched your changes for testing - looks ok. thanks again.
Comment From: helmut-hackl-dynatrace
one update:
in your fix
you throw in ReactorNettyClientRequest::convertException
- after falling thru - the IOException
this way:
return new IOException(ex.getMessage(), cause);
In case of eg. a io.netty.handler.timeout.ReadTimeoutException
both are null - the message plus the cause.
So you loose the connex to ex
and that it was a timeout that caused the exception.
Consumers like org.springframework.web.client.DefaultRestClient.DefaultRequestBodyUriSpec#createResourceAccessException
don't have this information at hand and throw a ResourceAccessException with "null" message.
Comment From: jhoeller
Good point! Revised for 6.1.11 in #33080, including the original exception if there is no cause now.