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 2022/06/27 10:12:29 UTC

[camel] 04/04: CAMEL-18232: camel-core - Invalid ThreadName pattern using default thread pattern on some JDKs

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 <cl...@gmail.com>
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;
     }
 
 }