Skip to content

Commit be0fed7

Browse files
author
Stephane Landelle
committed
Use StringBuilders instead of StringBuffers, close #305
1 parent 92d2d4b commit be0fed7

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

src/main/java/com/ning/http/client/resumable/PropertiesBasedResumableProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public void save(Map<String, Long> map) {
9090
}
9191

9292
private static String append(Map.Entry<String, Long> e) {
93-
return new StringBuffer(e.getKey()).append("=").append(e.getValue()).append("\n").toString();
93+
return new StringBuilder(e.getKey()).append("=").append(e.getValue()).append("\n").toString();
9494
}
9595

9696
/**

src/main/java/com/ning/http/multipart/MultipartRequestEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public String getContentType() {
143143
if (contentType.contains("boundary="))
144144
return contentType;
145145
else {
146-
StringBuffer buffer = new StringBuffer(contentType);
146+
StringBuilder buffer = new StringBuilder(contentType);
147147
if (!contentType.endsWith(";"))
148148
buffer.append(";");
149149
buffer.append(" boundary=");

src/main/java/com/ning/http/util/AsyncHttpProviderUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ private static void add(StringBuilder sb, String name, int val) {
456456
}
457457

458458
public static String constructUserAgent(Class<? extends AsyncHttpProvider> httpProvider) {
459-
StringBuffer b = new StringBuffer("AsyncHttpClient/1.0")
459+
StringBuilder b = new StringBuilder("AsyncHttpClient/1.0")
460460
.append(" ")
461461
.append("(")
462462
.append(httpProvider.getSimpleName())

src/test/java/com/ning/http/client/async/BasicAuthTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ public AbstractHandler configureHandler() throws Exception {
474474
}
475475

476476
@Test(groups = { "standalone", "default_provider" })
477-
public void StringBufferBodyConsumerTest() throws Throwable {
477+
public void StringBuilderBodyConsumerTest() throws Throwable {
478478
SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder().setRealmPrincipal(user).setRealmPassword(admin).setUrl(getTargetUrl()).setHeader("Content-Type", "text/html").build();
479479
try {
480480
StringBuilder s = new StringBuilder();

src/test/java/com/ning/http/client/async/SimpleAsyncHttpClientTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void inpuStreamBodyConsumerTest() throws Throwable {
5656
}
5757

5858
@Test(groups = { "standalone", "default_provider" })
59-
public void StringBufferBodyConsumerTest() throws Throwable {
59+
public void StringBuilderBodyConsumerTest() throws Throwable {
6060

6161
SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder().setIdleConnectionInPoolTimeoutInMs(100).setMaximumConnectionsTotal(50).setRequestTimeoutInMs(5 * 60 * 1000).setUrl(getTargetUrl()).setHeader("Content-Type", "text/html").build();
6262
try {

0 commit comments

Comments
 (0)