From 2e24582d2cd0fd9617920c334c723158edb2c1e8 Mon Sep 17 00:00:00 2001 From: penekhun Date: Mon, 6 Nov 2023 22:49:38 +0900 Subject: [PATCH] Avoid substring creation when string part to StringBuilder See gh-900 --- .../operation/preprocess/UriModifyingOperationPreprocessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-restdocs-core/src/main/java/org/springframework/restdocs/operation/preprocess/UriModifyingOperationPreprocessor.java b/spring-restdocs-core/src/main/java/org/springframework/restdocs/operation/preprocess/UriModifyingOperationPreprocessor.java index e6903481..e147a7f6 100644 --- a/spring-restdocs-core/src/main/java/org/springframework/restdocs/operation/preprocess/UriModifyingOperationPreprocessor.java +++ b/spring-restdocs-core/src/main/java/org/springframework/restdocs/operation/preprocess/UriModifyingOperationPreprocessor.java @@ -213,7 +213,7 @@ public class UriModifyingOperationPreprocessor implements OperationPreprocessor while (matcher.find()) { for (int i = 1; i <= matcher.groupCount(); i++) { if (matcher.start(i) >= 0) { - builder.append(input.substring(previous, matcher.start(i))); + builder.append(input, previous, matcher.start(i)); } if (matcher.start(i) >= 0) { previous = matcher.end(i);