You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/04/11 10:55:19 UTC

[camel] branch main updated: Replaced string concatenation in loop with StringJoiner. PR for components (#9842)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new d23bb2f3b47 Replaced string concatenation in loop with StringJoiner. PR for components (#9842)
d23bb2f3b47 is described below

commit d23bb2f3b47bd2058e7dc3d59559b284c56a5efb
Author: dk2k <dk...@users.noreply.github.com>
AuthorDate: Tue Apr 11 13:55:11 2023 +0300

    Replaced string concatenation in loop with StringJoiner. PR for components (#9842)
    
    Co-authored-by: dk2k <dk...@ya.ru>
---
 .../apache/camel/component/cxf/jaxws/DefaultCxfBinding.java   | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/DefaultCxfBinding.java b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/DefaultCxfBinding.java
index a2c234e1989..d199eefb6e4 100644
--- a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/DefaultCxfBinding.java
+++ b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/DefaultCxfBinding.java
@@ -32,6 +32,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.StringJoiner;
 import java.util.TreeMap;
 
 import jakarta.activation.DataHandler;
@@ -748,15 +749,11 @@ public class DefaultCxfBinding implements CxfBinding, HeaderFilterStrategyAware
     }
 
     protected String getContentTypeString(List<String> values) {
-        String result = "";
+        StringJoiner result = new StringJoiner("; ");
         for (String value : values) {
-            if (result.length() == 0) {
-                result = value;
-            } else {
-                result = result + "; " + value;
-            }
+            result.add(value);
         }
-        return result;
+        return result.toString();
     }
 
     @SuppressWarnings("unchecked")