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

commit 821adb8cc121dfdace94f20bf36346dbfb51b6bb
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Jun 27 12:09:44 2022 +0200

    CAMEL-18232: camel-core - Invalid ThreadName pattern using default thread 
pattern on some JDKs
---
 .../main/java/org/apache/camel/util/concurrent/ThreadHelper.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/core/camel-util/src/main/java/org/apache/camel/util/concurrent/ThreadHelper.java
 
b/core/camel-util/src/main/java/org/apache/camel/util/concurrent/ThreadHelper.java
index 9d44b70ef1e..e7e55d1fd0a 100644
--- 
a/core/camel-util/src/main/java/org/apache/camel/util/concurrent/ThreadHelper.java
+++ 
b/core/camel-util/src/main/java/org/apache/camel/util/concurrent/ThreadHelper.java
@@ -73,8 +73,12 @@ public final class ThreadHelper {
     }
 
     private static String replaceFirst(String input, String from, String to) {
-        // use StringHelper.replaceFirst as replace does not work on all JDK 
11s (CAMEL-18232)
-        return StringHelper.replaceFirst(input, from ,to);
+        // use StringHelper.replaceFirst and replaceFirst (regexp) as replace 
does not work on all JDK 11s (CAMEL-18232)
+        String answer = StringHelper.replaceFirst(input, from, to);
+        if (!to.contains("$")) {
+            answer = answer.replaceFirst(from, to);
+        }
+        return answer;
     }
 
 }

Reply via email to