Affects: - spring-web 6.1.11
There is a bug in the exception handling of the JettyClientHttpRequest
.
If a RestTemplate is used with the Jetty client and we try to connect to a nonexistent HTTP endpoint, we get an IllegalArgumentException
with the message Self-suppression not permitted
.
You can find a reproducer in the attached zip, including a pom.xml.
assertThatThrownBy(() -> this.restTemplateBuilder.build().exchange("http://localhost:12345", HttpMethod.POST, new HttpEntity<>("body", new HttpHeaders()), String.class))
.isNotInstanceOf(IllegalArgumentException.class)
.hasMessageNotContaining("Self-suppression not permitted");
Comment From: sdeleuze
@ReuDa Thanks for the repro, I tend to think this bug is on Jetty side and looks like similar with https://github.com/jetty/jetty.project/issues/12029. Do you agree?
Comment From: ReuDa
@sdeleuze Yes, that seems to be a perfect fit. The described workaround in the linked issue is working fine for me.
Thanks and sorry for the noise!
Comment From: sdeleuze
Np, thanks for the quick feedback.