This is an automated email from the ASF dual-hosted git repository. theigl pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/master by this push: new 28cda68 WICKET-6964 Do not allocate when escaping empty string (#502) 28cda68 is described below commit 28cda68f6e589b4a1d74536fd67c0bc570ebce6e Author: Thomas Heigl <thomas.he...@gmail.com> AuthorDate: Tue Mar 22 10:20:07 2022 +0100 WICKET-6964 Do not allocate when escaping empty string (#502) --- .../src/main/java/org/apache/wicket/util/string/Strings.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java b/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java index ee88c4b..384ec24 100755 --- a/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java @@ -296,7 +296,12 @@ public final class Strings return null; } - int len = s.length(); + final int len = s.length(); + if (len == 0) + { + return s; + } + final AppendingStringBuffer buffer = new AppendingStringBuffer((int)(len * 1.1)); for (int i = 0; i < len; i++)