[tomcat] branch 8.5.x updated: Use StringBuilder instead of StringBuffer

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[tomcat] branch 8.5.x updated: Use StringBuilder instead of StringBuffer

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 9d2afb9  Use StringBuilder instead of StringBuffer
9d2afb9 is described below

commit 9d2afb9c594c0d3b3867b88f17abfdc5fe96d4ea
Author: Martin Tzvetanov Grigorov <[hidden email]>
AuthorDate: Fri Jul 3 10:29:04 2020 +0300

    Use StringBuilder instead of StringBuffer
   
    There is no need of synchronization when it is a method local variable.
   
    Append character instead of String when possible
   
    Replace more .append(String) with .append(char)
   
    (cherry picked from commit d106b2b0305e443261704ee44fa0ce8f696d1059)
---
 .../authenticator/SingleSignOnSessionKey.java        |  2 +-
 .../apache/catalina/connector/CoyotePrincipal.java   |  2 +-
 java/org/apache/catalina/connector/Response.java     |  4 ++--
 .../catalina/core/ApplicationFilterConfig.java       |  2 +-
 java/org/apache/catalina/core/StandardServer.java    |  2 +-
 java/org/apache/catalina/core/StandardService.java   |  2 +-
 .../org/apache/catalina/ha/session/DeltaRequest.java |  2 +-
 .../org/apache/catalina/ha/session/DeltaSession.java |  2 +-
 java/org/apache/catalina/loader/WebappLoader.java    |  4 ++--
 java/org/apache/catalina/mbeans/MBeanDumper.java     |  1 -
 java/org/apache/catalina/realm/GenericPrincipal.java |  4 ++--
 java/org/apache/catalina/realm/RealmBase.java        |  6 +++---
 java/org/apache/catalina/servlets/CGIServlet.java    | 12 ++++++------
 .../org/apache/catalina/servlets/DefaultServlet.java | 20 ++++++++++----------
 java/org/apache/catalina/session/ManagerBase.java    |  2 +-
 .../org/apache/catalina/session/StandardSession.java |  2 +-
 .../org/apache/catalina/ssi/ExpressionParseTree.java |  4 ++--
 .../catalina/ssi/SSIServletExternalResolver.java     |  8 ++++----
 java/org/apache/catalina/startup/ContextConfig.java  |  1 -
 .../apache/catalina/startup/SetNextNamingRule.java   |  3 +--
 java/org/apache/catalina/startup/Tomcat.java         |  4 ++--
 .../apache/catalina/storeconfig/StoreFileMover.java  | 10 +++++-----
 .../apache/catalina/tribes/group/GroupChannel.java   |  6 +++---
 java/org/apache/catalina/tribes/io/ChannelData.java  |  8 ++++----
 .../catalina/tribes/membership/MemberImpl.java       | 14 +++++++-------
 .../catalina/tribes/tipis/AbstractReplicatedMap.java |  2 +-
 java/org/apache/catalina/tribes/util/Arrays.java     |  8 ++++----
 .../apache/catalina/users/MemoryUserDatabase.java    |  2 +-
 java/org/apache/catalina/util/Extension.java         |  2 +-
 java/org/apache/catalina/util/ManifestResource.java  |  2 +-
 java/org/apache/catalina/util/Strftime.java          |  2 +-
 .../catalina/valves/AbstractAccessLogValve.java      |  2 +-
 .../catalina/valves/ExtendedAccessLogValve.java      |  4 ++--
 .../catalina/valves/StuckThreadDetectionValve.java   |  2 +-
 .../apache/catalina/valves/rewrite/RewriteValve.java |  6 +++---
 .../apache/catalina/valves/rewrite/Substitution.java |  2 +-
 java/org/apache/coyote/ajp/AjpMessage.java           |  2 +-
 java/org/apache/jasper/compiler/Generator.java       |  2 +-
 java/org/apache/jasper/compiler/PageDataImpl.java    | 18 +++++++++---------
 java/org/apache/juli/JdkLoggerFormatter.java         |  6 +++---
 java/org/apache/naming/AbstractRef.java              |  4 ++--
 java/org/apache/tomcat/util/Diagnostics.java         |  2 +-
 java/org/apache/tomcat/util/MultiThrowable.java      |  4 ++--
 .../util/bcel/classfile/ArrayElementValue.java       |  6 +++---
 java/org/apache/tomcat/util/buf/UriUtil.java         |  2 +-
 .../util/descriptor/web/ApplicationParameter.java    |  2 +-
 .../tomcat/util/descriptor/web/ContextEjb.java       |  2 +-
 .../util/descriptor/web/ContextEnvironment.java      |  2 +-
 .../tomcat/util/descriptor/web/ContextHandler.java   |  2 +-
 .../tomcat/util/descriptor/web/ContextLocalEjb.java  |  2 +-
 .../tomcat/util/descriptor/web/ContextResource.java  |  2 +-
 .../util/descriptor/web/ContextResourceEnvRef.java   |  2 +-
 .../util/descriptor/web/ContextResourceLink.java     |  2 +-
 .../tomcat/util/descriptor/web/ContextService.java   |  2 +-
 .../util/descriptor/web/ContextTransaction.java      |  2 +-
 .../apache/tomcat/util/descriptor/web/ErrorPage.java |  2 +-
 .../apache/tomcat/util/descriptor/web/FilterDef.java |  2 +-
 .../apache/tomcat/util/descriptor/web/FilterMap.java |  2 +-
 .../tomcat/util/descriptor/web/LoginConfig.java      |  2 +-
 .../util/descriptor/web/MessageDestination.java      |  2 +-
 .../util/descriptor/web/MessageDestinationRef.java   |  2 +-
 .../util/descriptor/web/SecurityCollection.java      |  2 +-
 .../util/descriptor/web/SecurityConstraint.java      |  2 +-
 .../tomcat/util/descriptor/web/SecurityRoleRef.java  |  2 +-
 .../tomcat/util/descriptor/web/WebRuleSet.java       |  2 +-
 .../apache/tomcat/util/descriptor/web/WebXml.java    |  2 +-
 .../apache/tomcat/util/digester/CallMethodRule.java  | 18 ++++++++----------
 .../apache/tomcat/util/digester/CallParamRule.java   |  2 +-
 .../tomcat/util/digester/FactoryCreateRule.java      |  2 +-
 .../tomcat/util/digester/ObjectCreateRule.java       |  2 +-
 .../org/apache/tomcat/util/digester/SetNextRule.java |  2 +-
 .../tomcat/util/digester/SetPropertiesRule.java      |  2 +-
 .../tomcat/util/http/LegacyCookieProcessor.java      |  2 +-
 .../tomcat/util/http/fileupload/FileUploadBase.java  |  2 +-
 java/org/apache/tomcat/util/modeler/ManagedBean.java |  2 +-
 .../apache/tomcat/util/modeler/NotificationInfo.java |  2 +-
 java/org/apache/tomcat/util/net/AprEndpoint.java     |  6 +++---
 .../apache/tomcat/websocket/DigestAuthenticator.java | 10 +++++-----
 .../tomcat/websocket/server/WsHandshakeRequest.java  |  4 ++--
 79 files changed, 150 insertions(+), 155 deletions(-)

diff --git a/java/org/apache/catalina/authenticator/SingleSignOnSessionKey.java b/java/org/apache/catalina/authenticator/SingleSignOnSessionKey.java
index a4fb05b..a07946f 100644
--- a/java/org/apache/catalina/authenticator/SingleSignOnSessionKey.java
+++ b/java/org/apache/catalina/authenticator/SingleSignOnSessionKey.java
@@ -116,7 +116,7 @@ public class SingleSignOnSessionKey implements Serializable {
         sb.append(contextName);
         sb.append("], SessionID: [");
         sb.append(sessionId);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 }
diff --git a/java/org/apache/catalina/connector/CoyotePrincipal.java b/java/org/apache/catalina/connector/CoyotePrincipal.java
index 1ae5608..93d7c02 100644
--- a/java/org/apache/catalina/connector/CoyotePrincipal.java
+++ b/java/org/apache/catalina/connector/CoyotePrincipal.java
@@ -64,7 +64,7 @@ public class CoyotePrincipal implements Principal, Serializable {
     public String toString() {
         StringBuilder sb = new StringBuilder("CoyotePrincipal[");
         sb.append(this.name);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java
index b204bca..0140895 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -1821,10 +1821,10 @@ public class Response implements HttpServletResponse {
         }
         StringBuilder sb = new StringBuilder(path);
         if( sb.length() > 0 ) { // jsessionid can't be first.
-            sb.append(";");
+            sb.append(';');
             sb.append(SessionConfig.getSessionUriParamName(
                     request.getContext()));
-            sb.append("=");
+            sb.append('=');
             sb.append(sessionId);
         }
         sb.append(anchor);
diff --git a/java/org/apache/catalina/core/ApplicationFilterConfig.java b/java/org/apache/catalina/core/ApplicationFilterConfig.java
index 7ceab8f..d175fe4 100644
--- a/java/org/apache/catalina/core/ApplicationFilterConfig.java
+++ b/java/org/apache/catalina/core/ApplicationFilterConfig.java
@@ -217,7 +217,7 @@ public final class ApplicationFilterConfig implements FilterConfig, Serializable
         sb.append(filterDef.getFilterName());
         sb.append(", filterClass=");
         sb.append(filterDef.getFilterClass());
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/catalina/core/StandardServer.java b/java/org/apache/catalina/core/StandardServer.java
index cb58398..8746c6d 100644
--- a/java/org/apache/catalina/core/StandardServer.java
+++ b/java/org/apache/catalina/core/StandardServer.java
@@ -666,7 +666,7 @@ public final class StandardServer extends LifecycleMBeanBase implements Server {
     public String toString() {
         StringBuilder sb = new StringBuilder("StandardServer[");
         sb.append(getPort());
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/catalina/core/StandardService.java b/java/org/apache/catalina/core/StandardService.java
index 454df85..9d6b0ee 100644
--- a/java/org/apache/catalina/core/StandardService.java
+++ b/java/org/apache/catalina/core/StandardService.java
@@ -326,7 +326,7 @@ public class StandardService extends LifecycleMBeanBase implements Service {
     public String toString() {
         StringBuilder sb = new StringBuilder("StandardService[");
         sb.append(getName());
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/catalina/ha/session/DeltaRequest.java b/java/org/apache/catalina/ha/session/DeltaRequest.java
index c13da90..b4aa789 100644
--- a/java/org/apache/catalina/ha/session/DeltaRequest.java
+++ b/java/org/apache/catalina/ha/session/DeltaRequest.java
@@ -403,7 +403,7 @@ public class DeltaRequest implements Externalizable {
             StringBuilder buf = new StringBuilder("AttributeInfo[type=");
             buf.append(getType()).append(", action=").append(getAction());
             buf.append(", name=").append(getName()).append(", value=").append(getValue());
-            buf.append(", addr=").append(super.toString()).append("]");
+            buf.append(", addr=").append(super.toString()).append(']');
             return buf.toString();
         }
 
diff --git a/java/org/apache/catalina/ha/session/DeltaSession.java b/java/org/apache/catalina/ha/session/DeltaSession.java
index 3e4eb8f..4917305 100644
--- a/java/org/apache/catalina/ha/session/DeltaSession.java
+++ b/java/org/apache/catalina/ha/session/DeltaSession.java
@@ -562,7 +562,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
         StringBuilder sb = new StringBuilder();
         sb.append("DeltaSession[");
         sb.append(id);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/catalina/loader/WebappLoader.java b/java/org/apache/catalina/loader/WebappLoader.java
index 4c0670d..cb8f807 100644
--- a/java/org/apache/catalina/loader/WebappLoader.java
+++ b/java/org/apache/catalina/loader/WebappLoader.java
@@ -322,7 +322,7 @@ public class WebappLoader extends LifecycleMBeanBase
         String repositories[]=getLoaderRepositories();
         StringBuilder sb=new StringBuilder();
         for (String repository : repositories) {
-            sb.append(repository).append(":");
+            sb.append(repository).append(':');
         }
         return sb.toString();
     }
@@ -664,7 +664,7 @@ public class WebappLoader extends LifecycleMBeanBase
 
         String contextName = context.getName();
         if (!contextName.startsWith("/")) {
-            name.append("/");
+            name.append('/');
         }
         name.append(contextName);
 
diff --git a/java/org/apache/catalina/mbeans/MBeanDumper.java b/java/org/apache/catalina/mbeans/MBeanDumper.java
index cc0d9ce..83a43a0 100644
--- a/java/org/apache/catalina/mbeans/MBeanDumper.java
+++ b/java/org/apache/catalina/mbeans/MBeanDumper.java
@@ -187,5 +187,4 @@ public class MBeanDumper {
         }
         sb.append( value.substring(pos,end));
     }
-
 }
diff --git a/java/org/apache/catalina/realm/GenericPrincipal.java b/java/org/apache/catalina/realm/GenericPrincipal.java
index db68955..917a54e 100644
--- a/java/org/apache/catalina/realm/GenericPrincipal.java
+++ b/java/org/apache/catalina/realm/GenericPrincipal.java
@@ -219,9 +219,9 @@ public class GenericPrincipal implements TomcatPrincipal, Serializable {
     public String toString() {
         StringBuilder sb = new StringBuilder("GenericPrincipal[");
         sb.append(this.name);
-        sb.append("(");
+        sb.append('(');
         for (String role : roles) {
-            sb.append(role).append(",");
+            sb.append(role).append(',');
         }
         sb.append(")]");
         return sb.toString();
diff --git a/java/org/apache/catalina/realm/RealmBase.java b/java/org/apache/catalina/realm/RealmBase.java
index ae02312..faf9806 100644
--- a/java/org/apache/catalina/realm/RealmBase.java
+++ b/java/org/apache/catalina/realm/RealmBase.java
@@ -1043,17 +1043,17 @@ public abstract class RealmBase extends LifecycleMBeanBase implements org.apache
         file.append(protocol).append("://").append(host);
         // Host with port
         if(redirectPort != 443) {
-            file.append(":").append(redirectPort);
+            file.append(':').append(redirectPort);
         }
         // URI
         file.append(request.getRequestURI());
         String requestedSessionId = request.getRequestedSessionId();
         if ((requestedSessionId != null) &&
             request.isRequestedSessionIdFromURL()) {
-            file.append(";");
+            file.append(';');
             file.append(SessionConfig.getSessionUriParamName(
                     request.getContext()));
-            file.append("=");
+            file.append('=');
             file.append(requestedSessionId);
         }
         String queryString = request.getQueryString();
diff --git a/java/org/apache/catalina/servlets/CGIServlet.java b/java/org/apache/catalina/servlets/CGIServlet.java
index b59d7ea..6d6fb18 100644
--- a/java/org/apache/catalina/servlets/CGIServlet.java
+++ b/java/org/apache/catalina/servlets/CGIServlet.java
@@ -1161,12 +1161,12 @@ public final class CGIServlet extends HttpServlet {
                         new StringTokenizer (pathInfo, "/");
                 // start with first element
                 while (pathWalker.hasMoreElements() && (is == null)) {
-                    srcPath.append("/");
+                    srcPath.append('/');
                     srcPath.append(pathWalker.nextElement());
                     is = context.getResourceAsStream(srcPath.toString());
                 }
                 destPath.append(tmpDir);
-                destPath.append("/");
+                destPath.append('/');
                 destPath.append(srcPath);
             }
 
@@ -1252,13 +1252,13 @@ public final class CGIServlet extends HttpServlet {
                     sb.append(entry.getKey());
                     sb.append(": [");
                     sb.append(blanksToString(entry.getValue(), "will be set to blank"));
-                    sb.append("]");
+                    sb.append(']');
                     sb.append(System.lineSeparator());
                 }
 
                 sb.append("Derived Command :[");
                 sb.append(nullsToBlanks(command));
-                sb.append("]");
+                sb.append(']');
                 sb.append(System.lineSeparator());
 
 
@@ -1266,7 +1266,7 @@ public final class CGIServlet extends HttpServlet {
                 if (workingDirectory != null) {
                     sb.append(workingDirectory.toString());
                 }
-                sb.append("]");
+                sb.append(']');
                 sb.append(System.lineSeparator());
 
                 sb.append("Command Line Params:");
@@ -1274,7 +1274,7 @@ public final class CGIServlet extends HttpServlet {
                 for (String param : cmdLineParameters) {
                     sb.append("  [");
                     sb.append(param);
-                    sb.append("]");
+                    sb.append(']');
                     sb.append(System.lineSeparator());
                 }
             } else {
diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java
index 8bcb3ce..571c754 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -1705,7 +1705,7 @@ public class DefaultServlet extends HttpServlet {
         sb.append("<listing ");
         sb.append(" contextPath='");
         sb.append(contextPath);
-        sb.append("'");
+        sb.append('\'');
         sb.append(" directory='");
         sb.append(resource.getName());
         sb.append("' ");
@@ -1739,25 +1739,25 @@ public class DefaultServlet extends HttpServlet {
             sb.append("<entry");
             sb.append(" type='")
               .append(childResource.isDirectory()?"dir":"file")
-              .append("'");
+              .append('\'');
             sb.append(" urlPath='")
               .append(rewrittenContextPath)
               .append(rewriteUrl(directoryWebappPath + entry))
               .append(childResource.isDirectory()?"/":"")
-              .append("'");
+              .append('\'');
             if (childResource.isFile()) {
                 sb.append(" size='")
                   .append(renderSize(childResource.getContentLength()))
-                  .append("'");
+                  .append('\'');
             }
             sb.append(" date='")
               .append(childResource.getLastModifiedHttp())
-              .append("'");
+              .append('\'');
 
-            sb.append(">");
+            sb.append('>');
             sb.append(Escape.htmlElementContent(entry));
             if (childResource.isDirectory())
-                sb.append("/");
+                sb.append('/');
             sb.append("</entry>");
         }
         sb.append("</entries>");
@@ -1915,7 +1915,7 @@ public class DefaultServlet extends HttpServlet {
                 parent = "/";
             sb.append(rewriteUrl(parent));
             if (!parent.endsWith("/"))
-                sb.append("/");
+                sb.append('/');
             sb.append("\">");
             sb.append("<b>");
             sb.append(sm.getString("directory.parent", parent));
@@ -1997,11 +1997,11 @@ public class DefaultServlet extends HttpServlet {
             sb.append(rewrittenContextPath);
             sb.append(rewriteUrl(childResource.getWebappPath()));
             if (childResource.isDirectory())
-                sb.append("/");
+                sb.append('/');
             sb.append("\"><tt>");
             sb.append(Escape.htmlElementContent(filename));
             if (childResource.isDirectory())
-                sb.append("/");
+                sb.append('/');
             sb.append("</tt></a></td>\r\n");
 
             sb.append("<td align=\"right\"><tt>");
diff --git a/java/org/apache/catalina/session/ManagerBase.java b/java/org/apache/catalina/session/ManagerBase.java
index b1aa95a..b492b64 100644
--- a/java/org/apache/catalina/session/ManagerBase.java
+++ b/java/org/apache/catalina/session/ManagerBase.java
@@ -1107,7 +1107,7 @@ public abstract class ManagerBase extends LifecycleMBeanBase implements Manager
     public String listSessionIds() {
         StringBuilder sb = new StringBuilder();
         for (String s : sessions.keySet()) {
-            sb.append(s).append(" ");
+            sb.append(s).append(' ');
         }
         return sb.toString();
     }
diff --git a/java/org/apache/catalina/session/StandardSession.java b/java/org/apache/catalina/session/StandardSession.java
index 44c41be..9864946 100644
--- a/java/org/apache/catalina/session/StandardSession.java
+++ b/java/org/apache/catalina/session/StandardSession.java
@@ -1025,7 +1025,7 @@ public class StandardSession implements HttpSession, Session, Serializable {
         StringBuilder sb = new StringBuilder();
         sb.append("StandardSession[");
         sb.append(id);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/catalina/ssi/ExpressionParseTree.java b/java/org/apache/catalina/ssi/ExpressionParseTree.java
index 8d0c7a1..aba5d27 100644
--- a/java/org/apache/catalina/ssi/ExpressionParseTree.java
+++ b/java/org/apache/catalina/ssi/ExpressionParseTree.java
@@ -140,7 +140,7 @@ public class ExpressionParseTree {
                         nodeStack.add(0, currStringNode);
                     } else {
                         // Add to the existing
-                        currStringNode.value.append(" ");
+                        currStringNode.value.append(' ');
                         currStringNode.value.append(et.getTokenValue());
                     }
                     break;
@@ -439,4 +439,4 @@ public class ExpressionParseTree {
             return left + " " + right + " LT";
         }
     }
-}
\ No newline at end of file
+}
diff --git a/java/org/apache/catalina/ssi/SSIServletExternalResolver.java b/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
index 863a9d2..6c357bf 100644
--- a/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
+++ b/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
@@ -319,11 +319,11 @@ public class SSIServletExternalResolver implements SSIExternalResolver {
                 retVal = req.getProtocol();
             } else if (nameParts[1].equals("SOFTWARE")) {
                 StringBuilder rv = new StringBuilder(context.getServerInfo());
-                rv.append(" ");
+                rv.append(' ');
                 rv.append(System.getProperty("java.vm.name"));
-                rv.append("/");
+                rv.append('/');
                 rv.append(System.getProperty("java.vm.version"));
-                rv.append(" ");
+                rv.append(' ');
                 rv.append(System.getProperty("os.name"));
                 retVal = rv.toString();
             }
@@ -578,4 +578,4 @@ public class SSIServletExternalResolver implements SSIExternalResolver {
             return path;
         }
     }
-}
\ No newline at end of file
+}
diff --git a/java/org/apache/catalina/startup/ContextConfig.java b/java/org/apache/catalina/startup/ContextConfig.java
index a56ee23..1d89e3f 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -439,7 +439,6 @@ public class ContextConfig implements LifecycleListener {
         return digester;
     }
 
-
     /**
      * Process the default configuration file, if it exists.
      * @param digester The digester that will be used for XML parsing
diff --git a/java/org/apache/catalina/startup/SetNextNamingRule.java b/java/org/apache/catalina/startup/SetNextNamingRule.java
index c82fe06..065b58b 100644
--- a/java/org/apache/catalina/startup/SetNextNamingRule.java
+++ b/java/org/apache/catalina/startup/SetNextNamingRule.java
@@ -103,7 +103,6 @@ public class SetNextNamingRule extends Rule {
         // Call the specified method
         IntrospectionUtils.callMethod1(namingResources, methodName,
                 child, paramType, digester.getClassLoader());
-
     }
 
 
@@ -117,7 +116,7 @@ public class SetNextNamingRule extends Rule {
         sb.append(methodName);
         sb.append(", paramType=");
         sb.append(paramType);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/catalina/startup/Tomcat.java b/java/org/apache/catalina/startup/Tomcat.java
index fddc67a..67e990d 100644
--- a/java/org/apache/catalina/startup/Tomcat.java
+++ b/java/org/apache/catalina/startup/Tomcat.java
@@ -962,9 +962,9 @@ public class Tomcat {
         loggerName.append("].[");
         // Context name
         if (contextName == null || contextName.equals("")) {
-            loggerName.append("/");
+            loggerName.append('/');
         } else if (contextName.startsWith("##")) {
-            loggerName.append("/");
+            loggerName.append('/');
             loggerName.append(contextName);
         }
         loggerName.append(']');
diff --git a/java/org/apache/catalina/storeconfig/StoreFileMover.java b/java/org/apache/catalina/storeconfig/StoreFileMover.java
index a59b9c1..b52d5b8 100644
--- a/java/org/apache/catalina/storeconfig/StoreFileMover.java
+++ b/java/org/apache/catalina/storeconfig/StoreFileMover.java
@@ -200,14 +200,14 @@ public class StoreFileMover {
         String ts = (new Timestamp(System.currentTimeMillis())).toString();
         //        yyyy-mm-dd hh:mm:ss
         //        0123456789012345678
-        StringBuffer sb = new StringBuffer(".");
-        sb.append(ts.substring(0, 10));
+        StringBuilder sb = new StringBuilder(".");
+        sb.append(ts, 0, 10);
         sb.append('.');
-        sb.append(ts.substring(11, 13));
+        sb.append(ts, 11, 13);
         sb.append('-');
-        sb.append(ts.substring(14, 16));
+        sb.append(ts, 14, 16);
         sb.append('-');
-        sb.append(ts.substring(17, 19));
+        sb.append(ts, 17, 19);
         return sb.toString();
     }
 
diff --git a/java/org/apache/catalina/tribes/group/GroupChannel.java b/java/org/apache/catalina/tribes/group/GroupChannel.java
index 95731d6..cee9baa 100644
--- a/java/org/apache/catalina/tribes/group/GroupChannel.java
+++ b/java/org/apache/catalina/tribes/group/GroupChannel.java
@@ -424,13 +424,13 @@ public class GroupChannel extends ChannelInterceptorBase
                 while ( next != null ) {
                     int nflag = next.getOptionFlag();
                     if (nflag!=0 && (((flag & nflag) == flag ) || ((flag & nflag) == nflag)) ) {
-                        conflicts.append("[");
+                        conflicts.append('[');
                         conflicts.append(first.getClass().getName());
-                        conflicts.append(":");
+                        conflicts.append(':');
                         conflicts.append(flag);
                         conflicts.append(" == ");
                         conflicts.append(next.getClass().getName());
-                        conflicts.append(":");
+                        conflicts.append(':');
                         conflicts.append(nflag);
                         conflicts.append("] ");
                     }//end if
diff --git a/java/org/apache/catalina/tribes/io/ChannelData.java b/java/org/apache/catalina/tribes/io/ChannelData.java
index 17cdb1d..c9b1ed3 100644
--- a/java/org/apache/catalina/tribes/io/ChannelData.java
+++ b/java/org/apache/catalina/tribes/io/ChannelData.java
@@ -358,15 +358,15 @@ public class ChannelData implements ChannelMessage {
         buf.append("ClusterData[src=");
         buf.append(getAddress()).append("; id=");
         buf.append(bToS(getUniqueId())).append("; sent=");
-        buf.append(new Timestamp(this.getTimestamp()).toString()).append("]");
+        buf.append(new Timestamp(this.getTimestamp()).toString()).append(']');
         return buf.toString();
     }
 
     public static String bToS(byte[] data) {
         StringBuilder buf = new StringBuilder(4*16);
-        buf.append("{");
-        for (int i=0; data!=null && i<data.length; i++ ) buf.append(String.valueOf(data[i])).append(" ");
-        buf.append("}");
+        buf.append('{');
+        for (int i=0; data!=null && i<data.length; i++ ) buf.append(String.valueOf(data[i])).append(' ');
+        buf.append('}');
         return buf.toString();
     }
 
diff --git a/java/org/apache/catalina/tribes/membership/MemberImpl.java b/java/org/apache/catalina/tribes/membership/MemberImpl.java
index eb52eae..61648cc 100644
--- a/java/org/apache/catalina/tribes/membership/MemberImpl.java
+++ b/java/org/apache/catalina/tribes/membership/MemberImpl.java
@@ -533,9 +533,9 @@ public class MemberImpl implements Member, java.io.Externalizable {
     @Override
     public String toString()  {
         StringBuilder buf = new StringBuilder(getClass().getName());
-        buf.append("[");
-        buf.append(getName()).append(",");
-        buf.append(getHostname()).append(",");
+        buf.append('[');
+        buf.append(getName()).append(',');
+        buf.append(getHostname()).append(',');
         buf.append(port).append(", alive=");
         buf.append(memberAliveTime).append(", ");
         buf.append("securePort=").append(securePort).append(", ");
@@ -544,7 +544,7 @@ public class MemberImpl implements Member, java.io.Externalizable {
         buf.append("payload=").append(bToS(this.payload,8)).append(", ");
         buf.append("command=").append(bToS(this.command,8)).append(", ");
         buf.append("domain=").append(bToS(this.domain,8));
-        buf.append("]");
+        buf.append(']');
         return buf.toString();
     }
     public static String bToS(byte[] data) {
@@ -552,15 +552,15 @@ public class MemberImpl implements Member, java.io.Externalizable {
     }
     public static String bToS(byte[] data, int max) {
         StringBuilder buf = new StringBuilder(4*16);
-        buf.append("{");
+        buf.append('{');
         for (int i=0; data!=null && i<data.length; i++ ) {
-            buf.append(String.valueOf(data[i])).append(" ");
+            buf.append(String.valueOf(data[i])).append(' ');
             if ( i==max ) {
                 buf.append("...("+data.length+")");
                 break;
             }
         }
-        buf.append("}");
+        buf.append('}');
         return buf.toString();
     }
 
diff --git a/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java b/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
index 67cac26..d6f9ab4 100644
--- a/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
@@ -1427,7 +1427,7 @@ public abstract class AbstractReplicatedMap<K,V>
             buf.append(key);
             buf.append("; value=");
             buf.append(value);
-            buf.append("]");
+            buf.append(']');
             return buf.toString();
         }
 
diff --git a/java/org/apache/catalina/tribes/util/Arrays.java b/java/org/apache/catalina/tribes/util/Arrays.java
index 0da41df..eec9e08 100644
--- a/java/org/apache/catalina/tribes/util/Arrays.java
+++ b/java/org/apache/catalina/tribes/util/Arrays.java
@@ -71,7 +71,7 @@ public class Arrays {
                 }
             }
         }
-        buf.append("}");
+        buf.append('}');
         return buf.toString();
     }
 
@@ -87,7 +87,7 @@ public class Arrays {
                 buf.append(", ").append(data[i]);
             }
         }
-        buf.append("}");
+        buf.append('}');
         return buf.toString();
     }
 
@@ -103,7 +103,7 @@ public class Arrays {
                 buf.append(", ").append(data[i].getName());
             }
         }
-        buf.append("}");
+        buf.append('}');
         return buf.toString();
     }
 
@@ -211,4 +211,4 @@ public class Arrays {
     public static byte[] convert(String s) {
         return s.getBytes(StandardCharsets.ISO_8859_1);
     }
-}
\ No newline at end of file
+}
diff --git a/java/org/apache/catalina/users/MemoryUserDatabase.java b/java/org/apache/catalina/users/MemoryUserDatabase.java
index efde670..b4662f7 100644
--- a/java/org/apache/catalina/users/MemoryUserDatabase.java
+++ b/java/org/apache/catalina/users/MemoryUserDatabase.java
@@ -727,7 +727,7 @@ public class MemoryUserDatabase implements UserDatabase {
         sb.append(this.roles.size());
         sb.append(",userCount=");
         sb.append(this.users.size());
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 }
diff --git a/java/org/apache/catalina/util/Extension.java b/java/org/apache/catalina/util/Extension.java
index cf9489a..172f313 100644
--- a/java/org/apache/catalina/util/Extension.java
+++ b/java/org/apache/catalina/util/Extension.java
@@ -242,7 +242,7 @@ public final class Extension {
             sb.append(", specificationVersion=");
             sb.append(specificationVersion);
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/catalina/util/ManifestResource.java b/java/org/apache/catalina/util/ManifestResource.java
index 50776d2..2402b51 100644
--- a/java/org/apache/catalina/util/ManifestResource.java
+++ b/java/org/apache/catalina/util/ManifestResource.java
@@ -128,7 +128,7 @@ public class ManifestResource {
             case WAR : sb.append(", resourceType=WAR"); break;
             case APPLICATION : sb.append(", resourceType=APPLICATION"); break;
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/catalina/util/Strftime.java b/java/org/apache/catalina/util/Strftime.java
index a09e5b1..a051c8a 100644
--- a/java/org/apache/catalina/util/Strftime.java
+++ b/java/org/apache/catalina/util/Strftime.java
@@ -184,7 +184,7 @@ public class Strftime {
                 } else {
                     if ( !inside && c != ' ' ) {
                         //We start a literal, which we need to quote
-                        buf.append("'");
+                        buf.append('\'');
                         inside = true;
                     }
 
diff --git a/java/org/apache/catalina/valves/AbstractAccessLogValve.java b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
index 83f9c93..a6c1622 100644
--- a/java/org/apache/catalina/valves/AbstractAccessLogValve.java
+++ b/java/org/apache/catalina/valves/AbstractAccessLogValve.java
@@ -836,7 +836,7 @@ public abstract class AbstractAccessLogValve extends ValveBase implements Access
             if(info != null) {
                 buf.append(info.getWorkerThreadName());
             } else {
-                buf.append("-");
+                buf.append('-');
             }
         }
     }
diff --git a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
index fab3dd6..5a9fc0d 100644
--- a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
+++ b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
@@ -339,7 +339,7 @@ public class ExtendedAccessLogValve extends AccessLogValve {
                         if (first) {
                             first = false;
                         } else {
-                            buffer.append(",");
+                            buffer.append(',');
                         }
                         buffer.append(iter.next());
                     }
@@ -347,7 +347,7 @@ public class ExtendedAccessLogValve extends AccessLogValve {
                 }
                 return ;
             }
-            buf.append("-");
+            buf.append('-');
         }
     }
 
diff --git a/java/org/apache/catalina/valves/StuckThreadDetectionValve.java b/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
index abd6224..95338bb 100644
--- a/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
+++ b/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
@@ -195,7 +195,7 @@ public class StuckThreadDetectionValve extends ValveBase {
         Long key = Long.valueOf(Thread.currentThread().getId());
         StringBuffer requestUrl = request.getRequestURL();
         if(request.getQueryString()!=null) {
-            requestUrl.append("?");
+            requestUrl.append('?');
             requestUrl.append(request.getQueryString());
         }
         MonitoredThread monitoredThread = new MonitoredThread(Thread.currentThread(),
diff --git a/java/org/apache/catalina/valves/rewrite/RewriteValve.java b/java/org/apache/catalina/valves/rewrite/RewriteValve.java
index f84d2bf..88f17f3 100644
--- a/java/org/apache/catalina/valves/rewrite/RewriteValve.java
+++ b/java/org/apache/catalina/valves/rewrite/RewriteValve.java
@@ -209,7 +209,7 @@ public class RewriteValve extends ValveBase {
     }
 
     public String getConfiguration() {
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         for (String mapConfiguration : mapsConfiguration) {
             buffer.append(mapConfiguration).append("\r\n");
         }
@@ -389,8 +389,8 @@ public class RewriteValve extends ValveBase {
                         urlStringDecoded = urlStringDecoded.substring(0, index);
                     }
 
-                    StringBuffer urlStringEncoded =
-                            new StringBuffer(URLEncoder.DEFAULT.encode(urlStringDecoded, uriCharset));
+                    StringBuilder urlStringEncoded =
+                            new StringBuilder(URLEncoder.DEFAULT.encode(urlStringDecoded, uriCharset));
                     if (!qsd && originalQueryStringEncoded != null
                             && originalQueryStringEncoded.length() > 0) {
                         if (rewrittenQueryStringDecoded == null) {
diff --git a/java/org/apache/catalina/valves/rewrite/Substitution.java b/java/org/apache/catalina/valves/rewrite/Substitution.java
index 121fc1e..3470810 100644
--- a/java/org/apache/catalina/valves/rewrite/Substitution.java
+++ b/java/org/apache/catalina/valves/rewrite/Substitution.java
@@ -314,7 +314,7 @@ public class Substitution {
     }
 
     private String evaluateSubstitution(SubstitutionElement[] elements, Matcher rule, Matcher cond, Resolver resolver) {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
         for (SubstitutionElement element : elements) {
             buf.append(element.evaluate(rule, cond, resolver));
         }
diff --git a/java/org/apache/coyote/ajp/AjpMessage.java b/java/org/apache/coyote/ajp/AjpMessage.java
index dc6a6f4..9c93a59 100644
--- a/java/org/apache/coyote/ajp/AjpMessage.java
+++ b/java/org/apache/coyote/ajp/AjpMessage.java
@@ -407,7 +407,7 @@ public class AjpMessage {
             if (!Character.isISOControl((char) buf[i])) {
                 sb.append(Character.valueOf((char) buf[i]));
             } else {
-                sb.append(".");
+                sb.append('.');
             }
         }
         return sb.toString();
diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java
index fcfb517..47c568b 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -3082,7 +3082,7 @@ class Generator {
                         sb.append(".getValue(");
                         sb.append(getJspContextVar());
                         sb.append(".getELContext()");
-                        sb.append(")");
+                        sb.append(')');
                     }
                     attrValue = sb.toString();
                 } else if (attr.isDeferredMethodInput()
diff --git a/java/org/apache/jasper/compiler/PageDataImpl.java b/java/org/apache/jasper/compiler/PageDataImpl.java
index 592da5e..97f44dc 100644
--- a/java/org/apache/jasper/compiler/PageDataImpl.java
+++ b/java/org/apache/jasper/compiler/PageDataImpl.java
@@ -324,15 +324,15 @@ class PageDataImpl extends PageData implements TagConstants {
         @Override
     public void visit(Node.ELExpression n) throws JasperException {
             if (!n.getRoot().isXmlSyntax()) {
-                buf.append("<").append(JSP_TEXT_ACTION);
-                buf.append(" ");
+                buf.append('<').append(JSP_TEXT_ACTION);
+                buf.append(' ');
                 buf.append(jspIdPrefix);
                 buf.append(":id=\"");
                 buf.append(jspId++).append("\">");
             }
             buf.append("${");
             buf.append(Escape.xml(n.getText()));
-            buf.append("}");
+            buf.append('}');
             if (!n.getRoot().isXmlSyntax()) {
                 buf.append(JSP_TEXT_ACTION_END);
             }
@@ -464,7 +464,7 @@ class PageDataImpl extends PageData implements TagConstants {
             Node.Nodes body = n.getBody();
             String text = n.getText();
 
-            buf.append("<").append(n.getQName());
+            buf.append('<').append(n.getQName());
             buf.append("\n");
 
             printAttributes(n, addDefaultNS);
@@ -523,7 +523,7 @@ class PageDataImpl extends PageData implements TagConstants {
                 return;
             }
 
-            buf.append("<").append(n.getQName());
+            buf.append('<').append(n.getQName());
             buf.append("\n");
 
             // append jsp:id
@@ -557,7 +557,7 @@ class PageDataImpl extends PageData implements TagConstants {
                         first = false;
                         buf.append("  import=\"");
                     } else {
-                        buf.append(",");
+                        buf.append(',');
                     }
                     buf.append(JspUtil.getExprInXml(i));
                 }
@@ -576,7 +576,7 @@ class PageDataImpl extends PageData implements TagConstants {
          * ServletResponse.setContentType(), is derived from the pageInfo.
          */
         private void appendPageDirective() {
-            buf.append("<").append(JSP_PAGE_DIRECTIVE_ACTION);
+            buf.append('<').append(JSP_PAGE_DIRECTIVE_ACTION);
             buf.append("\n");
 
             // append jsp:id
@@ -622,7 +622,7 @@ class PageDataImpl extends PageData implements TagConstants {
          * attribute whose value is hard-coded to UTF-8.
          */
         private void appendTagDirective() {
-            buf.append("<").append(JSP_TAG_DIRECTIVE_ACTION);
+            buf.append('<').append(JSP_TAG_DIRECTIVE_ACTION);
             buf.append("\n");
 
             // append jsp:id
@@ -634,7 +634,7 @@ class PageDataImpl extends PageData implements TagConstants {
 
         private void appendText(String text, boolean createJspTextElement) {
             if (createJspTextElement) {
-                buf.append("<").append(JSP_TEXT_ACTION);
+                buf.append('<').append(JSP_TEXT_ACTION);
                 buf.append("\n");
 
                 // append jsp:id
diff --git a/java/org/apache/juli/JdkLoggerFormatter.java b/java/org/apache/juli/JdkLoggerFormatter.java
index 37b5d1a..99b9096 100644
--- a/java/org/apache/juli/JdkLoggerFormatter.java
+++ b/java/org/apache/juli/JdkLoggerFormatter.java
@@ -65,7 +65,7 @@ public class JdkLoggerFormatter extends Formatter {
         buf.append(time);
 
         // pad to 8 to make it more readable
-        for( int i=0; i<8-buf.length(); i++ ) { buf.append(" "); }
+        for( int i=0; i<8-buf.length(); i++ ) { buf.append(' '); }
 
         //      Append a readable representation of the log level.
         switch(level) {
@@ -81,10 +81,10 @@ public class JdkLoggerFormatter extends Formatter {
 
         // Append the name of the log instance if so configured
         buf.append(name);
-        buf.append(" ");
+        buf.append(' ');
 
         // pad to 20 chars
-        for( int i=0; i<8-buf.length(); i++ ) { buf.append(" "); }
+        for( int i=0; i<8-buf.length(); i++ ) { buf.append(' '); }
 
         // Append the message
         buf.append(message);
diff --git a/java/org/apache/naming/AbstractRef.java b/java/org/apache/naming/AbstractRef.java
index 1f53a66..e9a657b 100644
--- a/java/org/apache/naming/AbstractRef.java
+++ b/java/org/apache/naming/AbstractRef.java
@@ -79,9 +79,9 @@ public abstract class AbstractRef extends Reference {
             sb.append(refAddr.getType());
             sb.append(",content=");
             sb.append(refAddr.getContent());
-            sb.append("}");
+            sb.append('}');
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 }
diff --git a/java/org/apache/tomcat/util/Diagnostics.java b/java/org/apache/tomcat/util/Diagnostics.java
index 674099c..75b41cf 100644
--- a/java/org/apache/tomcat/util/Diagnostics.java
+++ b/java/org/apache/tomcat/util/Diagnostics.java
@@ -426,7 +426,7 @@ public class Diagnostics {
         sb.append(CRLF);
 
         sb.append(requestedSm.getString("diagnostics.threadDumpTitle"));
-        sb.append(" ");
+        sb.append(' ');
         sb.append(runtimeMXBean.getVmName());
         sb.append(" (");
         sb.append(runtimeMXBean.getVmVersion());
diff --git a/java/org/apache/tomcat/util/MultiThrowable.java b/java/org/apache/tomcat/util/MultiThrowable.java
index 5fca54e9..433eb8f 100644
--- a/java/org/apache/tomcat/util/MultiThrowable.java
+++ b/java/org/apache/tomcat/util/MultiThrowable.java
@@ -89,9 +89,9 @@ public class MultiThrowable extends Throwable {
         sb.append(size());
         sb.append(" wrapped Throwables: ");
         for (Throwable t : throwables) {
-            sb.append("[");
+            sb.append('[');
             sb.append(t.getMessage());
-            sb.append("]");
+            sb.append(']');
         }
 
         return sb.toString();
diff --git a/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java b/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
index f84054f..d5ee725 100644
--- a/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
+++ b/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
@@ -36,15 +36,15 @@ public class ArrayElementValue extends ElementValue
     public String stringifyValue()
     {
         final StringBuilder sb = new StringBuilder();
-        sb.append("[");
+        sb.append('[');
         for (int i = 0; i < evalues.length; i++)
         {
             sb.append(evalues[i].stringifyValue());
             if ((i + 1) < evalues.length) {
-                sb.append(",");
+                sb.append(',');
             }
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/buf/UriUtil.java b/java/org/apache/tomcat/util/buf/UriUtil.java
index fa56150..f88bc9d 100644
--- a/java/org/apache/tomcat/util/buf/UriUtil.java
+++ b/java/org/apache/tomcat/util/buf/UriUtil.java
@@ -46,7 +46,7 @@ public final class UriUtil {
         } else {
             WAR_SEPARATOR = custom + "/";
             PATTERN_CUSTOM = Pattern.compile(Pattern.quote(WAR_SEPARATOR));
-            StringBuffer sb = new StringBuffer(custom.length() * 3);
+            StringBuilder sb = new StringBuilder(custom.length() * 3);
             // Deliberately use the platform's default encoding
             byte[] ba = custom.getBytes();
             for (byte toEncode : ba) {
diff --git a/java/org/apache/tomcat/util/descriptor/web/ApplicationParameter.java b/java/org/apache/tomcat/util/descriptor/web/ApplicationParameter.java
index e280614..bdc7c0f 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ApplicationParameter.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ApplicationParameter.java
@@ -113,7 +113,7 @@ public class ApplicationParameter implements Serializable {
         sb.append(value);
         sb.append(", override=");
         sb.append(override);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
 
     }
diff --git a/java/org/apache/tomcat/util/descriptor/web/ContextEjb.java b/java/org/apache/tomcat/util/descriptor/web/ContextEjb.java
index 4190253..7f8fd83 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ContextEjb.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ContextEjb.java
@@ -107,7 +107,7 @@ public class ContextEjb extends ResourceBase {
             sb.append(", link=");
             sb.append(link);
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
 
     }
diff --git a/java/org/apache/tomcat/util/descriptor/web/ContextEnvironment.java b/java/org/apache/tomcat/util/descriptor/web/ContextEnvironment.java
index f51b250..1a239d4 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ContextEnvironment.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ContextEnvironment.java
@@ -86,7 +86,7 @@ public class ContextEnvironment extends ResourceBase {
         }
         sb.append(", override=");
         sb.append(override);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
 
     }
diff --git a/java/org/apache/tomcat/util/descriptor/web/ContextHandler.java b/java/org/apache/tomcat/util/descriptor/web/ContextHandler.java
index 281d718..ec353a4 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ContextHandler.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ContextHandler.java
@@ -146,7 +146,7 @@ public class ContextHandler extends ResourceBase {
             sb.append(", init-param=");
             sb.append(this.listProperties());
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/ContextLocalEjb.java b/java/org/apache/tomcat/util/descriptor/web/ContextLocalEjb.java
index 29e8d5e..c05da4a 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ContextLocalEjb.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ContextLocalEjb.java
@@ -106,7 +106,7 @@ public class ContextLocalEjb extends ResourceBase {
             sb.append(", local=");
             sb.append(local);
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/ContextResource.java b/java/org/apache/tomcat/util/descriptor/web/ContextResource.java
index dd3de30..1d2281b 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ContextResource.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ContextResource.java
@@ -129,7 +129,7 @@ public class ContextResource extends ResourceBase {
             sb.append(", scope=");
             sb.append(scope);
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/ContextResourceEnvRef.java b/java/org/apache/tomcat/util/descriptor/web/ContextResourceEnvRef.java
index ba3169c..9f4471b 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ContextResourceEnvRef.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ContextResourceEnvRef.java
@@ -63,7 +63,7 @@ public class ContextResourceEnvRef extends ResourceBase {
         }
         sb.append(", override=");
         sb.append(override);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/ContextResourceLink.java b/java/org/apache/tomcat/util/descriptor/web/ContextResourceLink.java
index e50dcf9..67ca79a 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ContextResourceLink.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ContextResourceLink.java
@@ -76,7 +76,7 @@ public class ContextResourceLink extends ResourceBase {
             sb.append(", global=");
             sb.append(getGlobal());
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/ContextService.java b/java/org/apache/tomcat/util/descriptor/web/ContextService.java
index eaa0d14..87bbd56 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ContextService.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ContextService.java
@@ -257,7 +257,7 @@ public class ContextService extends ResourceBase {
             sb.append(", handler=");
             sb.append(handlers);
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/ContextTransaction.java b/java/org/apache/tomcat/util/descriptor/web/ContextTransaction.java
index 4f87ecd..1a7609a 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ContextTransaction.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ContextTransaction.java
@@ -84,7 +84,7 @@ public class ContextTransaction implements Serializable {
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder("Transaction[");
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 }
diff --git a/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java b/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
index bf0920d..69963081 100644
--- a/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
+++ b/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
@@ -148,7 +148,7 @@ public class ErrorPage extends XmlEncodingBase implements Serializable {
         }
         sb.append(", location=");
         sb.append(location);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/FilterDef.java b/java/org/apache/tomcat/util/descriptor/web/FilterDef.java
index 8d70c79..dcee300 100644
--- a/java/org/apache/tomcat/util/descriptor/web/FilterDef.java
+++ b/java/org/apache/tomcat/util/descriptor/web/FilterDef.java
@@ -197,7 +197,7 @@ public class FilterDef implements Serializable {
         sb.append(this.filterName);
         sb.append(", filterClass=");
         sb.append(this.filterClass);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/FilterMap.java b/java/org/apache/tomcat/util/descriptor/web/FilterMap.java
index 4a3e4b1..aeb9199 100644
--- a/java/org/apache/tomcat/util/descriptor/web/FilterMap.java
+++ b/java/org/apache/tomcat/util/descriptor/web/FilterMap.java
@@ -214,7 +214,7 @@ public class FilterMap extends XmlEncodingBase implements Serializable {
             sb.append(", urlPattern=");
             sb.append(urlPattern);
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/LoginConfig.java b/java/org/apache/tomcat/util/descriptor/web/LoginConfig.java
index 053eb80..afe9aa9 100644
--- a/java/org/apache/tomcat/util/descriptor/web/LoginConfig.java
+++ b/java/org/apache/tomcat/util/descriptor/web/LoginConfig.java
@@ -155,7 +155,7 @@ public class LoginConfig extends XmlEncodingBase implements Serializable {
             sb.append(", errorPage=");
             sb.append(errorPage);
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/MessageDestination.java b/java/org/apache/tomcat/util/descriptor/web/MessageDestination.java
index be9fcfb..d323a76 100644
--- a/java/org/apache/tomcat/util/descriptor/web/MessageDestination.java
+++ b/java/org/apache/tomcat/util/descriptor/web/MessageDestination.java
@@ -101,7 +101,7 @@ public class MessageDestination extends ResourceBase {
             sb.append(", description=");
             sb.append(getDescription());
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/MessageDestinationRef.java b/java/org/apache/tomcat/util/descriptor/web/MessageDestinationRef.java
index 25d9f67..5118898 100644
--- a/java/org/apache/tomcat/util/descriptor/web/MessageDestinationRef.java
+++ b/java/org/apache/tomcat/util/descriptor/web/MessageDestinationRef.java
@@ -86,7 +86,7 @@ public class MessageDestinationRef extends ResourceBase {
             sb.append(", description=");
             sb.append(getDescription());
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java b/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java
index 3d77772..44a79ca 100644
--- a/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java
+++ b/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java
@@ -390,7 +390,7 @@ public class SecurityCollection extends XmlEncodingBase implements Serializable
             sb.append(", ");
             sb.append(description);
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/SecurityConstraint.java b/java/org/apache/tomcat/util/descriptor/web/SecurityConstraint.java
index 36d65ba..7215874 100644
--- a/java/org/apache/tomcat/util/descriptor/web/SecurityConstraint.java
+++ b/java/org/apache/tomcat/util/descriptor/web/SecurityConstraint.java
@@ -475,7 +475,7 @@ public class SecurityConstraint extends XmlEncodingBase implements Serializable
                 sb.append(", ");
             sb.append(collections[i].getName());
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/SecurityRoleRef.java b/java/org/apache/tomcat/util/descriptor/web/SecurityRoleRef.java
index 360ea7c..92083c2 100644
--- a/java/org/apache/tomcat/util/descriptor/web/SecurityRoleRef.java
+++ b/java/org/apache/tomcat/util/descriptor/web/SecurityRoleRef.java
@@ -79,7 +79,7 @@ public class SecurityRoleRef implements Serializable {
             sb.append(", link=");
             sb.append(link);
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java b/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
index 2faf735..af729d7 100644
--- a/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
+++ b/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
@@ -1021,7 +1021,7 @@ final class CallMethodMultiRule extends CallMethodRule {
             sb.append(targetOffset);
             sb.append(",stackdepth=");
             sb.append(digester.getCount());
-            sb.append(")");
+            sb.append(')');
             throw new org.xml.sax.SAXException(sb.toString());
         }
 
diff --git a/java/org/apache/tomcat/util/descriptor/web/WebXml.java b/java/org/apache/tomcat/util/descriptor/web/WebXml.java
index eaae0e0..20c1df9 100644
--- a/java/org/apache/tomcat/util/descriptor/web/WebXml.java
+++ b/java/org/apache/tomcat/util/descriptor/web/WebXml.java
@@ -721,7 +721,7 @@ public class WebXml extends XmlEncodingBase implements DocumentProperties.Encodi
             sb.append("\"http://www.w3.org/2001/XMLSchema-instance\"\n");
             sb.append("         xsi:schemaLocation=\"");
             sb.append(javaeeNamespace);
-            sb.append(" ");
+            sb.append(' ');
             sb.append(webXmlSchemaLocation);
             sb.append("\"\n");
             sb.append("         version=\"");
diff --git a/java/org/apache/tomcat/util/digester/CallMethodRule.java b/java/org/apache/tomcat/util/digester/CallMethodRule.java
index 67530aa..1f2ea96 100644
--- a/java/org/apache/tomcat/util/digester/CallMethodRule.java
+++ b/java/org/apache/tomcat/util/digester/CallMethodRule.java
@@ -392,7 +392,7 @@ public class CallMethodRule extends Rule {
             sb.append(targetOffset);
             sb.append(",stackdepth=");
             sb.append(digester.getCount());
-            sb.append(")");
+            sb.append(')');
             throw new org.xml.sax.SAXException(sb.toString());
         }
 
@@ -402,26 +402,26 @@ public class CallMethodRule extends Rule {
             sb.append(digester.match);
             sb.append("} Call ");
             sb.append(target.getClass().getName());
-            sb.append(".");
+            sb.append('.');
             sb.append(methodName);
-            sb.append("(");
+            sb.append('(');
             for (int i = 0; i < paramValues.length; i++) {
                 if (i > 0) {
-                    sb.append(",");
+                    sb.append(',');
                 }
                 if (paramValues[i] == null) {
                     sb.append("null");
                 } else {
                     sb.append(paramValues[i].toString());
                 }
-                sb.append("/");
+                sb.append('/');
                 if (paramTypes[i] == null) {
                     sb.append("null");
                 } else {
                     sb.append(paramTypes[i].getName());
                 }
             }
-            sb.append(")");
+            sb.append(')');
             digester.log.debug(sb.toString());
         }
         Object result = IntrospectionUtils.callMethodN(target, methodName,
@@ -469,10 +469,8 @@ public class CallMethodRule extends Rule {
                 sb.append(paramTypes[i].getName());
             }
         }
-        sb.append("}");
-        sb.append("]");
+        sb.append('}');
+        sb.append(']');
         return sb.toString();
     }
-
-
 }
diff --git a/java/org/apache/tomcat/util/digester/CallParamRule.java b/java/org/apache/tomcat/util/digester/CallParamRule.java
index a952f3a..799318c 100644
--- a/java/org/apache/tomcat/util/digester/CallParamRule.java
+++ b/java/org/apache/tomcat/util/digester/CallParamRule.java
@@ -198,7 +198,7 @@ public class CallParamRule extends Rule {
         sb.append(attributeName);
         sb.append(", from stack=");
         sb.append(fromStack);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/digester/FactoryCreateRule.java b/java/org/apache/tomcat/util/digester/FactoryCreateRule.java
index b6f7ad4..9a79055 100644
--- a/java/org/apache/tomcat/util/digester/FactoryCreateRule.java
+++ b/java/org/apache/tomcat/util/digester/FactoryCreateRule.java
@@ -173,7 +173,7 @@ public class FactoryCreateRule extends Rule {
             sb.append("creationFactory=");
             sb.append(creationFactory);
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 }
diff --git a/java/org/apache/tomcat/util/digester/ObjectCreateRule.java b/java/org/apache/tomcat/util/digester/ObjectCreateRule.java
index 22fb038..71cc365 100644
--- a/java/org/apache/tomcat/util/digester/ObjectCreateRule.java
+++ b/java/org/apache/tomcat/util/digester/ObjectCreateRule.java
@@ -150,7 +150,7 @@ public class ObjectCreateRule extends Rule {
         sb.append(className);
         sb.append(", attributeName=");
         sb.append(attributeName);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/digester/SetNextRule.java b/java/org/apache/tomcat/util/digester/SetNextRule.java
index bb8eb9f..083636b 100644
--- a/java/org/apache/tomcat/util/digester/SetNextRule.java
+++ b/java/org/apache/tomcat/util/digester/SetNextRule.java
@@ -158,7 +158,7 @@ public class SetNextRule extends Rule {
         sb.append(methodName);
         sb.append(", paramType=");
         sb.append(paramType);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 
diff --git a/java/org/apache/tomcat/util/digester/SetPropertiesRule.java b/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
index 3ad71f6..01ef4f7 100644
--- a/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
+++ b/java/org/apache/tomcat/util/digester/SetPropertiesRule.java
@@ -87,7 +87,7 @@ public class SetPropertiesRule extends Rule {
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder("SetPropertiesRule[");
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 }
diff --git a/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java b/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
index d87c7c2..e03d1e6 100644
--- a/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
+++ b/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
@@ -270,7 +270,7 @@ public final class LegacyCookieProcessor extends CookieProcessorBase {
 
         // Just use the name supplied in the Cookie
         buf.append(cookie.getName());
-        buf.append("=");
+        buf.append('=');
 
         // Value
         maybeQuote(buf, value, version);
diff --git a/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java b/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
index 4a68be2..96b2508 100644
--- a/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
+++ b/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
@@ -491,7 +491,7 @@ public abstract class FileUploadBase {
                 }
                 // Continuation line found
                 end = parseEndOfLine(headerPart, nonWs);
-                header.append(" ").append(headerPart.substring(nonWs, end));
+                header.append(' ').append(headerPart.substring(nonWs, end));
                 start = end + 2;
             }
             parseHeaderLine(headers, header.toString());
diff --git a/java/org/apache/tomcat/util/modeler/ManagedBean.java b/java/org/apache/tomcat/util/modeler/ManagedBean.java
index a21ca35..8fd898e 100644
--- a/java/org/apache/tomcat/util/modeler/ManagedBean.java
+++ b/java/org/apache/tomcat/util/modeler/ManagedBean.java
@@ -419,7 +419,7 @@ public class ManagedBean implements java.io.Serializable {
         }
         sb.append(", type=");
         sb.append(type);
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
 
     }
diff --git a/java/org/apache/tomcat/util/modeler/NotificationInfo.java b/java/org/apache/tomcat/util/modeler/NotificationInfo.java
index 19159cf..5a660b5 100644
--- a/java/org/apache/tomcat/util/modeler/NotificationInfo.java
+++ b/java/org/apache/tomcat/util/modeler/NotificationInfo.java
@@ -150,7 +150,7 @@ public class NotificationInfo extends FeatureInfo {
         } finally {
             readLock.unlock();
         }
-        sb.append("]");
+        sb.append(']');
         return sb.toString();
     }
 }
diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 8717d30..342502b 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -1335,15 +1335,15 @@ public class AprEndpoint extends AbstractEndpoint<Long> implements SNICallBack {
          */
         @Override
         public String toString() {
-            StringBuffer buf = new StringBuffer();
+            StringBuilder buf = new StringBuilder();
             buf.append("Poller");
             long[] res = new long[pollerSize * 2];
             int count = Poll.pollset(aprPoller, res);
             buf.append(" [ ");
             for (int j = 0; j < count; j++) {
-                buf.append(desc[2*j+1]).append(" ");
+                buf.append(desc[2*j+1]).append(' ');
             }
-            buf.append("]");
+            buf.append(']');
             return buf.toString();
         }
 
diff --git a/java/org/apache/tomcat/websocket/DigestAuthenticator.java b/java/org/apache/tomcat/websocket/DigestAuthenticator.java
index 021489f..a343159 100644
--- a/java/org/apache/tomcat/websocket/DigestAuthenticator.java
+++ b/java/org/apache/tomcat/websocket/DigestAuthenticator.java
@@ -116,19 +116,19 @@ public class DigestAuthenticator extends Authenticator {
         String A2 = "GET:" + requestUri;
 
         preDigest.append(encodeMD5(A1));
-        preDigest.append(":");
+        preDigest.append(':');
         preDigest.append(nonce);
 
         if (qop.toLowerCase().contains("auth")) {
-            preDigest.append(":");
+            preDigest.append(':');
             preDigest.append(String.format("%08X", Integer.valueOf(nonceCount)));
-            preDigest.append(":");
+            preDigest.append(':');
             preDigest.append(String.valueOf(cNonce));
-            preDigest.append(":");
+            preDigest.append(':');
             preDigest.append(qop);
         }
 
-        preDigest.append(":");
+        preDigest.append(':');
         preDigest.append(encodeMD5(A2));
 
         return encodeMD5(preDigest.toString());
diff --git a/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java b/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java
index 6c9f214..cb8bd2f 100644
--- a/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java
+++ b/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java
@@ -144,7 +144,7 @@ public class WsHandshakeRequest implements HandshakeRequest {
      */
     private static URI buildRequestUri(HttpServletRequest req) {
 
-        StringBuffer uri = new StringBuffer();
+        StringBuilder uri = new StringBuilder();
         String scheme = req.getScheme();
         int port = req.getServerPort();
         if (port < 0) {
@@ -174,7 +174,7 @@ public class WsHandshakeRequest implements HandshakeRequest {
         uri.append(req.getRequestURI());
 
         if (req.getQueryString() != null) {
-            uri.append("?");
+            uri.append('?');
             uri.append(req.getQueryString());
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]