Repository: camel Updated Branches: refs/heads/camel-2.18.x 035120f6d -> 6cb332c52 refs/heads/camel-2.19.x 0a03e9a4b -> 084e4334b refs/heads/master 41a9d04c4 -> 6d5ce82be
Prevent crash when route IDs contain dollar signs Spring Boot configured route get names like `UpdateRelationCamelRoute$$EnhancerBySpringCGLIB$$24c87b04`. The dollar signs are interpreted as group references since the `java.lang.String#replaceFirst()` method works with regular expressions. An alternative to the proposed change is to use the `java.lang.String#replace()` method, assuming users of `MetricsRoutePolicy` don't put the `##routeId##` token multiple places in the name pattern and really want to keep all but the first literal occurrence. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5609fae9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5609fae9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5609fae9 Branch: refs/heads/master Commit: 5609fae98ca5f0e982df53349a3435361d445c03 Parents: 41a9d04 Author: Sune Keller <[email protected]> Authored: Tue Jun 6 13:26:41 2017 +0200 Committer: Claus Ibsen <[email protected]> Committed: Tue Jun 6 16:55:07 2017 +0200 ---------------------------------------------------------------------- .../camel/component/metrics/routepolicy/MetricsRoutePolicy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/5609fae9/components/camel-metrics/src/main/java/org/apache/camel/component/metrics/routepolicy/MetricsRoutePolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/component/metrics/routepolicy/MetricsRoutePolicy.java b/components/camel-metrics/src/main/java/org/apache/camel/component/metrics/routepolicy/MetricsRoutePolicy.java index f39b33d..7eaa655 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/component/metrics/routepolicy/MetricsRoutePolicy.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/component/metrics/routepolicy/MetricsRoutePolicy.java @@ -171,7 +171,7 @@ public class MetricsRoutePolicy extends RoutePolicySupport implements NonManaged String answer = namePattern; answer = answer.replaceFirst("##name##", name); - answer = answer.replaceFirst("##routeId##", route.getId()); + answer = answer.replaceFirst("##routeId##", java.util.regex.Matcher.quoteReplacement(route.getId())); answer = answer.replaceFirst("##type##", type); return answer; }
