This is an automated email from the ASF dual-hosted git repository.

lihan pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 7ba2e5c8b8 Improve: Reuse the instance of StringBuilder to avoid 
duplicate object creation (#588)
7ba2e5c8b8 is described below

commit 7ba2e5c8b822a5140eecf3280ef608090b1120d1
Author: Andrei Briukhov <andreybr...@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 e2eb61aa61..6768b0d421 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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to