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 2019/06/14 07:35:29 UTC

[camel] branch master updated: CAMEL-13645: Fixed potential NPE in NotifyBuilder.

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 012f744  CAMEL-13645: Fixed potential NPE in NotifyBuilder.
012f744 is described below

commit 012f744396a6f3f15a7f91a7a0d1b9cea7663495
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 14 09:35:08 2019 +0200

    CAMEL-13645: Fixed potential NPE in NotifyBuilder.
---
 .../src/main/java/org/apache/camel/builder/NotifyBuilder.java     | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/core/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java b/core/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java
index 764e235..1fd4677 100644
--- a/core/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java
+++ b/core/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java
@@ -117,7 +117,11 @@ public class NotifyBuilder {
             @Override
             public boolean onExchange(Exchange exchange) {
                 // filter non matching exchanges
-                return EndpointHelper.matchEndpoint(context, exchange.getFromEndpoint().getEndpointUri(), endpointUri);
+                if (exchange.getFromEndpoint() != null) {
+                    return EndpointHelper.matchEndpoint(context, exchange.getFromEndpoint().getEndpointUri(), endpointUri);
+                } else {
+                    return false;
+                }
             }
 
             public boolean matches() {
@@ -191,7 +195,7 @@ public class NotifyBuilder {
                 // and just continue to route that on the consumer side, which causes the EventNotifier not to
                 // emit events when the consumer received the exchange, as its already done. For example by
                 // ProducerTemplate which creates the UoW before producing messages.
-                if (exchange.getFromEndpoint().getEndpointUri().startsWith("direct:")) {
+                if (exchange.getFromEndpoint() != null && exchange.getFromEndpoint().getEndpointUri().startsWith("direct:")) {
                     return true;
                 }
                 return PatternHelper.matchPattern(exchange.getFromRouteId(), "*");