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 2020/08/24 10:01:35 UTC

[camel] branch master updated: CAMEL-15457: Fixed NPE in camel-micromemter. Thanks to Espen Andreassen for reporting and the suggested place to fix.

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

davsclaus 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 df0dfdd  CAMEL-15457: Fixed NPE in camel-micromemter. Thanks to Espen Andreassen for reporting and the suggested place to fix.
df0dfdd is described below

commit df0dfddeb205bf29a8148cb2862308f7a5b8a853
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Aug 24 12:00:57 2020 +0200

    CAMEL-15457: Fixed NPE in camel-micromemter. Thanks to Espen Andreassen for reporting and the suggested place to fix.
---
 .../MicrometerExchangeEventNotifierNamingStrategy.java     | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/eventnotifier/MicrometerExchangeEventNotifierNamingStrategy.java b/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/eventnotifier/MicrometerExchangeEventNotifierNamingStrategy.java
index 539d61c..6e6f664 100644
--- a/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/eventnotifier/MicrometerExchangeEventNotifierNamingStrategy.java
+++ b/components/camel-micrometer/src/main/java/org/apache/camel/component/micrometer/eventnotifier/MicrometerExchangeEventNotifierNamingStrategy.java
@@ -55,9 +55,15 @@ public interface MicrometerExchangeEventNotifierNamingStrategy {
     }
 
     default Tags getInflightExchangesTags(ExchangeEvent event, Endpoint endpoint) {
-        return Tags.of(
-                CAMEL_CONTEXT_TAG, event.getExchange().getContext().getName(),
-                SERVICE_NAME, MicrometerEventNotifierService.class.getSimpleName(),
-                ROUTE_ID_TAG, event.getExchange().getFromRouteId());
+        if (event.getExchange().getFromRouteId() != null) {
+            return Tags.of(
+                    CAMEL_CONTEXT_TAG, event.getExchange().getContext().getName(),
+                    SERVICE_NAME, MicrometerEventNotifierService.class.getSimpleName(),
+                    ROUTE_ID_TAG, event.getExchange().getFromRouteId());
+        } else {
+            return Tags.of(
+                    CAMEL_CONTEXT_TAG, event.getExchange().getContext().getName(),
+                    SERVICE_NAME, MicrometerEventNotifierService.class.getSimpleName());
+        }
     }
 }