StringBuffer replaced with StringBuilder in ApiServerService

Signed-off-by: Laszlo Hornyak <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c6d25499
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c6d25499
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c6d25499

Branch: refs/heads/master
Commit: c6d254993979cdfb47085120708391b0ee9b96e8
Parents: aef76f7
Author: Laszlo Hornyak <[email protected]>
Authored: Sun Mar 23 12:26:55 2014 +0100
Committer: Laszlo Hornyak <[email protected]>
Committed: Mon Mar 24 21:04:06 2014 +0100

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiServer.java        | 6 +++---
 server/src/com/cloud/api/ApiServerService.java | 2 +-
 server/src/com/cloud/api/ApiServlet.java       | 2 +-
 server/test/com/cloud/api/ApiServletTest.java  | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c6d25499/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java 
b/server/src/com/cloud/api/ApiServer.java
index bde3f24..42ac8b7 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -280,7 +280,7 @@ public class ApiServer extends ManagerBase implements 
HttpRequestHandler, ApiSer
     public void handle(final HttpRequest request, final HttpResponse response, 
final HttpContext context) throws HttpException, IOException {
 
         // Create StringBuffer to log information in access log
-        final StringBuffer sb = new StringBuffer();
+        final StringBuilder sb = new StringBuilder();
         final HttpServerConnection connObj = 
(HttpServerConnection)context.getAttribute("http.connection");
         if (connObj instanceof SocketHttpServerConnection) {
             final InetAddress remoteAddr = 
((SocketHttpServerConnection)connObj).getRemoteAddress();
@@ -365,7 +365,7 @@ public class ApiServer extends ManagerBase implements 
HttpRequestHandler, ApiSer
 
     @Override
     @SuppressWarnings("rawtypes")
-    public String handleRequest(final Map params, final String responseType, 
final StringBuffer auditTrailSb) throws ServerApiException {
+    public String handleRequest(final Map params, final String responseType, 
final StringBuilder auditTrailSb) throws ServerApiException {
         checkCharacterInkParams(params);
 
         String response = null;
@@ -645,7 +645,7 @@ public class ApiServer extends ManagerBase implements 
HttpRequestHandler, ApiSer
         }
     }
 
-    private void buildAuditTrail(final StringBuffer auditTrailSb, final String 
command, final String result) {
+    private void buildAuditTrail(final StringBuilder auditTrailSb, final 
String command, final String result) {
         if (result == null) {
             return;
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c6d25499/server/src/com/cloud/api/ApiServerService.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServerService.java 
b/server/src/com/cloud/api/ApiServerService.java
index bf0ba23..5d078c3 100644
--- a/server/src/com/cloud/api/ApiServerService.java
+++ b/server/src/com/cloud/api/ApiServerService.java
@@ -40,7 +40,7 @@ public interface ApiServerService {
 
     public String getSerializedApiError(ServerApiException ex, Map<String, 
Object[]> apiCommandParams, String responseType);
 
-    public String handleRequest(Map params, String responseType, StringBuffer 
auditTrailSb) throws ServerApiException;
+    public String handleRequest(Map params, String responseType, StringBuilder 
auditTrailSb) throws ServerApiException;
 
     public Class<?> getCmdClass(String cmdName);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c6d25499/server/src/com/cloud/api/ApiServlet.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServlet.java 
b/server/src/com/cloud/api/ApiServlet.java
index f6dc8a7..e78bf38 100755
--- a/server/src/com/cloud/api/ApiServlet.java
+++ b/server/src/com/cloud/api/ApiServlet.java
@@ -121,7 +121,7 @@ public class ApiServlet extends HttpServlet {
     }
 
     void processRequestInContext(final HttpServletRequest req, final 
HttpServletResponse resp) {
-        final StringBuffer auditTrailSb = new StringBuffer();
+        final StringBuilder auditTrailSb = new StringBuilder(128);
         auditTrailSb.append(" ").append(req.getRemoteAddr());
         auditTrailSb.append(" -- ").append(req.getMethod()).append(' ');
         // get the response format since we'll need it in a couple of places

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c6d25499/server/test/com/cloud/api/ApiServletTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/api/ApiServletTest.java 
b/server/test/com/cloud/api/ApiServletTest.java
index 48f3e7c..4d54599 100644
--- a/server/test/com/cloud/api/ApiServletTest.java
+++ b/server/test/com/cloud/api/ApiServletTest.java
@@ -169,7 +169,7 @@ public class ApiServletTest {
         
Mockito.verify(response).setStatus(HttpServletResponse.SC_UNAUTHORIZED);
         Mockito.verify(apiServer, Mockito.never()).handleRequest(
                 Mockito.anyMap(), Mockito.anyString(),
-                Mockito.any(StringBuffer.class));
+                Mockito.any(StringBuilder.class));
     }
 
     @SuppressWarnings("unchecked")
@@ -183,7 +183,7 @@ public class ApiServletTest {
         Mockito.verify(response).setStatus(HttpServletResponse.SC_OK);
         Mockito.verify(apiServer, Mockito.times(1)).handleRequest(
                 Mockito.anyMap(), Mockito.anyString(),
-                Mockito.any(StringBuffer.class));
+                Mockito.any(StringBuilder.class));
     }
 
     @Test

Reply via email to