You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by li...@apache.org on 2023/02/10 08:37:04 UTC
[tomcat] branch 10.1.x updated: Improve: Reuse the instance of StringBuilder to avoid duplicate object creation (#588)
This is an automated email from the ASF dual-hosted git repository.
lihan pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new cd06594f7f Improve: Reuse the instance of StringBuilder to avoid duplicate object creation (#588)
cd06594f7f is described below
commit cd06594f7f9d2e52abbccc6d9e42827a5f41f8bf
Author: Andrei Briukhov <an...@gmail.com>
AuthorDate: Fri Feb 10 11:34:59 2023 +0300
Improve: Reuse the instance of StringBuilder to avoid duplicate object creation (#588)
---
java/org/apache/catalina/valves/ExtendedAccessLogValve.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
index 74dc8b871a..62faf87356 100644
--- a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
+++ b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
@@ -432,22 +432,22 @@ public class ExtendedAccessLogValve extends AccessLogValve {
switch (c) {
case ' ':
result = buf.toString();
- buf = new StringBuilder();
+ buf.setLength(0);
buf.append((char) c);
return result;
case '-':
result = buf.toString();
- buf = new StringBuilder();
+ buf.setLength(0);
subToken = true;
return result;
case '(':
result = buf.toString();
- buf = new StringBuilder();
+ buf.setLength(0);
parameter = true;
return result;
case ')':
result = buf.toString();
- buf = new StringBuilder();
+ buf.setLength(0);
break;
default:
buf.append((char) c);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org