From df7b162935b00ea89f1614d40f9e9139e0b4e527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20P=C3=B3ka?= Date: Wed, 1 Jun 2022 02:13:32 +0200 Subject: [PATCH] Always construct new exception on error, otherwise memory leak occurs on repeated use of singleton exception. --- .../web/reactive/function/client/DefaultWebClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java index e7589c41faa7..0b7b80a9fc7d 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java @@ -68,7 +68,7 @@ class DefaultWebClient implements WebClient { private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate"; private static final Mono NO_HTTP_CLIENT_RESPONSE_ERROR = Mono.error( - new IllegalStateException("The underlying HTTP client completed without emitting a response.")); + () -> new IllegalStateException("The underlying HTTP client completed without emitting a response.")); private final ExchangeFunction exchangeFunction;