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.
Comment From: icguy
FYI this has been fixed in https://github.com/jetty/jetty.project/issues/12029 and shipped with jetty 12.0.26. Which as far as I can tell is used since Spring 6.2.11, so the latest 6.2.x should have this fix.