From 1d5ffaf30ae40616a765c0d6c0c73de0e947dafa 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 1/2] Always construct new exception on error in
DefaultWebClient
Always construct new exception on error, otherwise memory leak may
occur due to repeated use of singleton exception.
Closes gh-28550
---
.../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 efaf758ef4..42025065cd 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;
From cda1e5507c829779a88098be0e1b0aa3851e6bc2 Mon Sep 17 00:00:00 2001
From: Sam Brannen
Date: Wed, 1 Jun 2022 16:28:05 +0200
Subject: [PATCH 2/2] Polishing
---
.../web/reactive/function/client/DefaultWebClient.java | 2 +-
.../web/reactive/function/client/ExchangeFilterFunctions.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
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 42025065cd..2250eb4df2 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctions.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctions.java
index b7d6c3d720..485d5d9e8d 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctions.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctions.java
@@ -71,7 +71,7 @@ public abstract class ExchangeFilterFunctions {
* Return a filter that generates an error signal when the given
* {@link HttpStatus} predicate matches.
* @param statusPredicate the predicate to check the HTTP status with
- * @param exceptionFunction the function that to create the exception
+ * @param exceptionFunction the function to create the exception
* @return the filter to generate an error signal
*/
public static ExchangeFilterFunction statusError(Predicate statusPredicate,