StringBuffer replaced with StringBuilder in ApiServerService

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
This commit is contained in:
Laszlo Hornyak 2014-03-23 12:26:55 +01:00
parent aef76f71ec
commit c6d2549939
4 changed files with 7 additions and 7 deletions

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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

View File

@ -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