camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] branch master updated: CAMEL-15626: Use StringBuilder instead of StringBuffer
Date Mon, 05 Oct 2020 07:18:43 GMT
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new da29359  CAMEL-15626: Use StringBuilder instead of StringBuffer
da29359 is described below

commit da293599c7e4084004cee1b53262b7f6f48506d2
Author: Miguel Serra <serramiguel1@gmail.com>
AuthorDate: Sun Oct 4 17:27:06 2020 +0100

    CAMEL-15626: Use StringBuilder instead of StringBuffer
    
    Signed-off-by: Miguel Serra <serramiguel1@gmail.com>
---
 .../atmosphere/websocket/WebsocketRouteTest.java   |  6 +-
 .../BindySimpleFixedLengthHeaderFooterTest.java    | 18 ++--
 ...BindyFixedLengthHeaderFooterSkipHeaderTest.java | 12 +--
 .../camel/component/cm/test/CMMessageTest.java     | 96 +++++++++++-----------
 .../org/apache/camel/component/cm/test/CMTest.java |  6 +-
 .../component/jetty/JettyStreamCacheIssueTest.java |  2 +-
 .../apache/camel/component/ldif/LdifRouteTest.java |  8 +-
 .../servlet/ServletCamelRouterTestSupport.java     |  3 +-
 .../bean/BeanMethodWithStringParameterTest.java    |  2 +-
 .../DynamicRouterConvertBodyToIssueTest.java       |  2 +-
 10 files changed, 77 insertions(+), 78 deletions(-)

diff --git a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/atmosphere/websocket/WebsocketRouteTest.java
b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/atmosphere/websocket/WebsocketRouteTest.java
index 926882e..7aa4ad6 100644
--- a/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/atmosphere/websocket/WebsocketRouteTest.java
+++ b/components/camel-atmosphere-websocket/src/test/java/org/apache/camel/component/atmosphere/websocket/WebsocketRouteTest.java
@@ -203,12 +203,12 @@ public class WebsocketRouteTest extends WebsocketCamelRouterTestSupport
{
     }
 
     private static String readAll(Reader reader) {
-        StringBuffer strbuf = new StringBuffer();
+        StringBuilder builder = new StringBuilder();
         try {
             char[] buf = new char[4024];
             int n;
             while ((n = reader.read(buf, 0, buf.length)) > 0) {
-                strbuf.append(buf, 0, n);
+                builder.append(buf, 0, n);
             }
         } catch (IOException e) {
             // ignore
@@ -220,7 +220,7 @@ public class WebsocketRouteTest extends WebsocketCamelRouterTestSupport
{
             }
         }
 
-        return strbuf.toString();
+        return builder.toString();
     }
 
     private static byte[] readAll(InputStream is) {
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/BindySimpleFixedLengthHeaderFooterTest.java
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/BindySimpleFixedLengthHeaderFooterTest.java
index a36676d..c1b052c 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/BindySimpleFixedLengthHeaderFooterTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/headerfooter/BindySimpleFixedLengthHeaderFooterTest.java
@@ -68,12 +68,12 @@ public class BindySimpleFixedLengthHeaderFooterTest extends CamelTestSupport
{
     @Test
     public void testUnmarshallMessage() throws Exception {
 
-        StringBuffer buff = new StringBuffer();
-        buff.append(TEST_HEADER).append(TEST_RECORD).append(TEST_FOOTER);
+        StringBuilder sb = new StringBuilder();
+        sb.append(TEST_HEADER).append(TEST_RECORD).append(TEST_FOOTER);
 
         unmarshallResult.expectedMessageCount(1);
 
-        template.sendBody(URI_DIRECT_UNMARSHALL, buff.toString());
+        template.sendBody(URI_DIRECT_UNMARSHALL, sb.toString());
 
         unmarshallResult.assertIsSatisfied();
 
@@ -138,9 +138,9 @@ public class BindySimpleFixedLengthHeaderFooterTest extends CamelTestSupport
{
         input.add(createFooterRow());
 
         marshallResult.expectedMessageCount(1);
-        StringBuffer buff = new StringBuffer();
-        buff.append(TEST_HEADER).append(TEST_RECORD).append(TEST_FOOTER);
-        marshallResult.expectedBodiesReceived(Arrays.asList(new String[] { buff.toString()
}));
+        StringBuilder sb = new StringBuilder();
+        sb.append(TEST_HEADER).append(TEST_RECORD).append(TEST_FOOTER);
+        marshallResult.expectedBodiesReceived(Arrays.asList(new String[] { sb.toString()
}));
         template.sendBody(URI_DIRECT_MARSHALL, input);
         marshallResult.assertIsSatisfied();
     }
@@ -177,9 +177,9 @@ public class BindySimpleFixedLengthHeaderFooterTest extends CamelTestSupport
{
 
         marshallResult.reset();
         marshallResult.expectedMessageCount(1);
-        StringBuffer buff = new StringBuffer();
-        buff.append(TEST_HEADER).append(TEST_RECORD).append(TEST_FOOTER);
-        marshallResult.expectedBodiesReceived(Arrays.asList(new String[] { buff.toString()
}));
+        StringBuilder sb = new StringBuilder();
+        sb.append(TEST_HEADER).append(TEST_RECORD).append(TEST_FOOTER);
+        marshallResult.expectedBodiesReceived(Arrays.asList(new String[] { sb.toString()
}));
         template.sendBodyAndHeaders(URI_DIRECT_MARSHALL, input, headers);
         marshallResult.assertIsSatisfied();
     }
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/BindyFixedLengthHeaderFooterSkipHeaderTest.java
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/BindyFixedLengthHeaderFooterSkipHeaderTest.java
index 9cb7668..76b4b44 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/BindyFixedLengthHeaderFooterSkipHeaderTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/skipheader/BindyFixedLengthHeaderFooterSkipHeaderTest.java
@@ -68,12 +68,12 @@ public class BindyFixedLengthHeaderFooterSkipHeaderTest extends CamelTestSupport
     @Test
     public void testUnmarshallMessage() throws Exception {
 
-        StringBuffer buff = new StringBuffer();
-        buff.append(TEST_HEADER).append(TEST_RECORD).append(TEST_FOOTER);
+        StringBuilder sb = new StringBuilder();
+        sb.append(TEST_HEADER).append(TEST_RECORD).append(TEST_FOOTER);
 
         unmarshallResult.expectedMessageCount(1);
 
-        template.sendBody(URI_DIRECT_UNMARSHALL, buff.toString());
+        template.sendBody(URI_DIRECT_UNMARSHALL, sb.toString());
 
         unmarshallResult.assertIsSatisfied();
 
@@ -120,9 +120,9 @@ public class BindyFixedLengthHeaderFooterSkipHeaderTest extends CamelTestSupport
         input.add(createFooterRow());
 
         marshallResult.expectedMessageCount(1);
-        StringBuffer buff = new StringBuffer();
-        buff.append(TEST_RECORD).append(TEST_FOOTER);
-        marshallResult.expectedBodiesReceived(Arrays.asList(new String[] { buff.toString()
}));
+        StringBuilder sb = new StringBuilder();
+        sb.append(TEST_RECORD).append(TEST_FOOTER);
+        marshallResult.expectedBodiesReceived(Arrays.asList(new String[] { sb.toString()
}));
         template.sendBody(URI_DIRECT_MARSHALL, input);
         marshallResult.assertIsSatisfied();
     }
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
index 87af8cb..397791d 100644
--- a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
@@ -53,12 +53,12 @@ public class CMMessageTest {
 
         // 0338 and less than 160 char -> 1 part
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
-            message.append("a");
+            sb.append("a");
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 1, "Call to getMultiparts() should have
returned 1");
@@ -69,12 +69,12 @@ public class CMMessageTest {
     public void testGSM338AndEQMAXGSMMESSAGELENGTH() throws Exception {
         // 0338 and length is exactly 160 -> 1 part
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH; index++) {
-            message.append("a");
+            sb.append("a");
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 1, "Call to getMultiparts() should have
returned 1");
@@ -86,12 +86,12 @@ public class CMMessageTest {
 
         // 0338 and length is exactly 161 -> 2 part
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < CMConstants.MAX_GSM_MESSAGE_LENGTH + 1; index++) {
-            message.append("a");
+            sb.append("a");
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() should have
returned 2");
@@ -101,12 +101,12 @@ public class CMMessageTest {
     @Test
     public void testGSM338AndLT2MAXGSMMESSAGELENGTH() throws Exception {
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART
- 1); index++) {
-            message.append("a");
+            sb.append("a");
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() should have
returned 2");
@@ -116,12 +116,12 @@ public class CMMessageTest {
     @Test
     public void testGSM338AndEQ2MAXGSMMESSAGELENGTH() throws Exception {
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART);
index++) {
-            message.append("a");
+            sb.append("a");
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() should have
returned 2");
@@ -131,12 +131,12 @@ public class CMMessageTest {
     @Test
     public void testGSM338AndGT2MAXGSMMESSAGELENGTH() throws Exception {
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (2 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART
+ 1); index++) {
-            message.append("a");
+            sb.append("a");
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 3, "Call to getMultiparts() should have
returned 3");
@@ -146,12 +146,12 @@ public class CMMessageTest {
     @Test
     public void testGSM338AndEQ8MAXGSMMESSAGELENGTH() throws Exception {
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART);
index++) {
-            message.append("a");
+            sb.append("a");
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 8, "Call to getMultiparts() should have
returned 8");
@@ -161,12 +161,12 @@ public class CMMessageTest {
     @Test
     public void testGSM338AndGT8MAXGSMMESSAGELENGTH() throws Exception {
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART
+ 1); index++) {
-            message.append("a");
+            sb.append("a");
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 8, "Call to getMultiparts() should have
returned 8");
@@ -184,12 +184,12 @@ public class CMMessageTest {
 
         // 0338 and less than 160 char -> 1 part
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
-            message.append(ch);
+            sb.append(ch);
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 1, "Call to getMultiparts() should have
returned 1");
@@ -202,12 +202,12 @@ public class CMMessageTest {
 
         String ch = "\uF400";
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH; index++) {
-            message.append(ch);
+            sb.append(ch);
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 1, "Call to getMultiparts() should have
returned 1");
@@ -221,12 +221,12 @@ public class CMMessageTest {
 
         String ch = "\uF400";
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < CMConstants.MAX_UNICODE_MESSAGE_LENGTH + 1; index++)
{
-            message.append(ch);
+            sb.append(ch);
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() should have
returned 2");
@@ -238,12 +238,12 @@ public class CMMessageTest {
 
         String ch = "\uF400";
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART
- 1); index++) {
-            message.append(ch);
+            sb.append(ch);
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() should have
returned 2");
@@ -255,12 +255,12 @@ public class CMMessageTest {
 
         String ch = "\uF400";
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART);
index++) {
-            message.append(ch);
+            sb.append(ch);
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() should have
returned 2");
@@ -272,12 +272,12 @@ public class CMMessageTest {
 
         String ch = "\uF400";
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (2 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART
+ 1); index++) {
-            message.append(ch);
+            sb.append(ch);
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 3, "Call to getMultiparts() should have
returned 3");
@@ -289,12 +289,12 @@ public class CMMessageTest {
 
         String ch = "\uF400";
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (8 * CMConstants.MAX_UNICODE_MESSAGE_LENGTH_PER_PART_IF_MULTIPART);
index++) {
-            message.append(ch);
+            sb.append(ch);
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 8, "Call to getMultiparts() should have
returned 8");
@@ -306,12 +306,12 @@ public class CMMessageTest {
 
         String ch = "\uF400";
 
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (8 * CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART
+ 1); index++) {
-            message.append(ch);
+            sb.append(ch);
         }
 
-        final CMMessage cmMessage = new CMMessage(validNumber, message.toString());
+        final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
         Assert.isTrue(cmMessage.getMultiparts() == 8, "Call to getMultiparts() should have
returned 8");
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
index 2e1b842..ae5af6e 100644
--- a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
@@ -372,11 +372,11 @@ public class CMTest {
     private String generateRandomLengthMessageByChar(String ch) {
         // random Length
         int msgLength = (int) (Math.random() * 2000);
-        StringBuffer message = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int index = 0; index < msgLength; index++) {
-            message.append(ch);
+            sb.append(ch);
         }
-        return message.toString();
+        return sb.toString();
     }
 
     //
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyStreamCacheIssueTest.java
b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyStreamCacheIssueTest.java
index 13622fe..bd80a09 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyStreamCacheIssueTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyStreamCacheIssueTest.java
@@ -38,7 +38,7 @@ public class JettyStreamCacheIssueTest extends BaseJettyTest {
 
     @Test
     public void testStreamCache() throws Exception {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int i = 0; i < 10000; i++) {
             sb.append("0123456789");
         }
diff --git a/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifRouteTest.java
b/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifRouteTest.java
index 68b120f..9b02ed4 100644
--- a/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifRouteTest.java
+++ b/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifRouteTest.java
@@ -352,13 +352,13 @@ public class LdifRouteTest extends AbstractLdapTestUnit {
      */
     private String readUrl(URL in) throws IOException {
         BufferedReader br = new BufferedReader(new InputStreamReader(in.openStream()));
-        StringBuffer buf = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         String s;
 
         while (null != (s = br.readLine())) {
-            buf.append(s);
-            buf.append('\n');
+            sb.append(s);
+            sb.append('\n');
         }
-        return buf.toString();
+        return sb.toString();
     }
 }
diff --git a/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletCamelRouterTestSupport.java
b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletCamelRouterTestSupport.java
index 08724cb..5e6b41c 100644
--- a/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletCamelRouterTestSupport.java
+++ b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletCamelRouterTestSupport.java
@@ -279,12 +279,11 @@ public class ServletCamelRouterTestSupport extends CamelTestSupport
{
         }
 
         public String toString() {
-            StringBuffer sb = new StringBuffer(2048).append("Error on HTTP request: ");
+            StringBuilder sb = new StringBuilder().append("Error on HTTP request: ");
             sb.append(code);
             if (message != null) {
                 sb.append(" ");
                 sb.append(message);
-                sb.append("");
             }
             if (url != null) {
                 sb.append(" [");
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithStringParameterTest.java
b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithStringParameterTest.java
index 7c9cbbd..9324fbb 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithStringParameterTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/bean/BeanMethodWithStringParameterTest.java
@@ -67,7 +67,7 @@ public class BeanMethodWithStringParameterTest extends ContextTestSupport
{
     public static final class MyBean {
 
         public static String doSomething(String name, int repeat) {
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             for (int i = 0; i < repeat; i++) {
                 sb.append(name);
             }
diff --git a/core/camel-management/src/test/java/org/apache/camel/issues/DynamicRouterConvertBodyToIssueTest.java
b/core/camel-management/src/test/java/org/apache/camel/issues/DynamicRouterConvertBodyToIssueTest.java
index 6423577..30789cf 100644
--- a/core/camel-management/src/test/java/org/apache/camel/issues/DynamicRouterConvertBodyToIssueTest.java
+++ b/core/camel-management/src/test/java/org/apache/camel/issues/DynamicRouterConvertBodyToIssueTest.java
@@ -66,7 +66,7 @@ public class DynamicRouterConvertBodyToIssueTest extends ContextTestSupport
impl
         log.info("Some: " + counter);
 
         exchange.setProperty("EXIT", "NO");
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int i = 0; i < 10000; i++) {
             sb.append(UUID.randomUUID().toString());
         }


Mime
View raw message