You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by on...@apache.org on 2018/07/11 14:01:46 UTC

[camel] branch camel-2.22.x updated: CAMEL-12653: Avoid NPE in case of null attributes

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

onders pushed a commit to branch camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.22.x by this push:
     new b8b8333  CAMEL-12653: Avoid NPE in case of null attributes
b8b8333 is described below

commit b8b8333e27f6f539e2668bdf92e38dd2b227e81d
Author: Aurélien Pupier <ap...@redhat.com>
AuthorDate: Wed Jul 11 10:14:09 2018 +0200

    CAMEL-12653: Avoid NPE in case of null attributes
    
    Signed-off-by: Aurélien Pupier <ap...@redhat.com>
---
 .../java/org/apache/camel/parser/model/CamelEndpointDetails.java | 9 ++++-----
 .../java/org/apache/camel/parser/model/CamelRouteDetails.java    | 4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelEndpointDetails.java b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelEndpointDetails.java
index 3b112a4..a74b75d 100644
--- a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelEndpointDetails.java
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelEndpointDetails.java
@@ -132,7 +132,7 @@ public class CamelEndpointDetails {
         if (lineNumberEnd != null ? !lineNumberEnd.equals(that.lineNumberEnd) : that.lineNumberEnd != null) {
             return false;
         }
-        if (!className.equals(that.className)) {
+        if (className != null ? !className.equals(that.className) : that.className != null) {
             return false;
         }
         if (methodName != null ? !methodName.equals(that.methodName) : that.methodName != null) {
@@ -141,8 +141,7 @@ public class CamelEndpointDetails {
         if (endpointInstance != null ? !endpointInstance.equals(that.endpointInstance) : that.endpointInstance != null) {
             return false;
         }
-        return endpointUri.equals(that.endpointUri);
-
+        return endpointUri != null ? endpointUri.equals(that.endpointUri) : that.endpointUri != null;
     }
 
     @Override
@@ -150,10 +149,10 @@ public class CamelEndpointDetails {
         int result = fileName.hashCode();
         result = 31 * result + (lineNumber != null ? lineNumber.hashCode() : 0);
         result = 31 * result + (lineNumberEnd != null ? lineNumberEnd.hashCode() : 0);
-        result = 31 * result + className.hashCode();
+        result = 31 * result + (className != null ? className.hashCode() : 0);
         result = 31 * result + (methodName != null ? methodName.hashCode() : 0);
         result = 31 * result + (endpointInstance != null ? endpointInstance.hashCode() : 0);
-        result = 31 * result + endpointUri.hashCode();
+        result = 31 * result + (endpointUri != null ? endpointUri.hashCode() : 0);
         return result;
     }
 
diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelRouteDetails.java b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelRouteDetails.java
index f87463a..c72f120 100644
--- a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelRouteDetails.java
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelRouteDetails.java
@@ -96,7 +96,7 @@ public class CamelRouteDetails {
         if (lineNumberEnd != null ? !lineNumberEnd.equals(that.lineNumberEnd) : that.lineNumberEnd != null) {
             return false;
         }
-        if (!className.equals(that.className)) {
+        if (className != null ? !className.equals(that.className) : that.className != null) {
             return false;
         }
         if (methodName != null ? !methodName.equals(that.methodName) : that.methodName != null) {
@@ -113,7 +113,7 @@ public class CamelRouteDetails {
         int result = fileName.hashCode();
         result = 31 * result + (lineNumber != null ? lineNumber.hashCode() : 0);
         result = 31 * result + (lineNumberEnd != null ? lineNumberEnd.hashCode() : 0);
-        result = 31 * result + className.hashCode();
+        result = 31 * result + (className != null ? className.hashCode() : 0);
         result = 31 * result + (methodName != null ? methodName.hashCode() : 0);
         result = 31 * result + (routeId != null ? routeId.hashCode() : 0);
         return result;