You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by nn...@apache.org on 2018/11/05 23:27:15 UTC

[geode] branch develop updated: GEODE-5983: use equals() instead of == (#2777)

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

nnag pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 54cf7d1  GEODE-5983: use equals() instead of == (#2777)
54cf7d1 is described below

commit 54cf7d1e6ec966167f7e5e855f054f9e4ae4bafa
Author: Nabarun Nag <na...@users.noreply.github.com>
AuthorDate: Mon Nov 5 15:27:03 2018 -0800

    GEODE-5983: use equals() instead of == (#2777)
    
    * For boxed primitive types equals() is used instead of ==
---
 .../java/org/apache/geode/connectors/jdbc/internal/SqlHandler.java   | 2 +-
 .../org/apache/geode/internal/cache/DistributedCacheOperation.java   | 3 ++-
 .../geode/management/internal/cli/functions/RegionFunctionArgs.java  | 5 ++++-
 .../org/apache/geode/redis/internal/executor/list/ListExecutor.java  | 2 +-
 .../cache/lucene/internal/LuceneFileRegionColocationListener.java    | 5 +++--
 5 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/SqlHandler.java b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/SqlHandler.java
index 36cc53b..2cf5a1b 100644
--- a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/SqlHandler.java
+++ b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/SqlHandler.java
@@ -126,7 +126,7 @@ public class SqlHandler {
     if (value instanceof Character) {
       Character character = ((Character) value);
       // if null character, set to null string instead of a string with the null character
-      value = character == Character.valueOf((char) 0) ? null : character.toString();
+      value = character.equals(Character.valueOf((char) 0)) ? null : character.toString();
     } else if (value instanceof Date) {
       Date jdkDate = (Date) value;
       switch (columnData.getDataType()) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
index aac3015..1238fae 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
@@ -746,7 +746,8 @@ public abstract class DistributedCacheOperation {
           Long cqID = e.getKey();
           // For the CQs satisfying the event with destroy CQEvent, remove
           // the entry form CQ cache.
-          if (cq.getFilterID() == cqID && (e.getValue().equals(MessageType.LOCAL_DESTROY))) {
+          if (cq != null && cq.getFilterID() != null && cq.getFilterID().equals(cqID)
+              && (e.getValue().equals(MessageType.LOCAL_DESTROY))) {
             cq.removeFromCqResultKeys(((EntryOperation) event).getKey(), true);
           }
         }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionFunctionArgs.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionFunctionArgs.java
index 5b06ce3..37eec45 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionFunctionArgs.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionFunctionArgs.java
@@ -500,7 +500,10 @@ public class RegionFunctionArgs implements Serializable {
       }
 
       ExpirationAttrs that = (ExpirationAttrs) object;
-      return time == that.time && action == that.action;
+      if (time == null && that.time == null && action == that.action) {
+        return true;
+      }
+      return time != null && time.equals(that.time) && action == that.action;
     }
 
     public boolean isTimeSet() {
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java
index 3f0a111..2077fff 100755
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/list/ListExecutor.java
@@ -71,7 +71,7 @@ public abstract class ListExecutor extends AbstractExecutor {
     String oppositeKey = pushType == ListDirection.RIGHT ? "head" : "tail";
     Integer index = (Integer) keyRegion.get(indexKey);
     Integer opp = (Integer) keyRegion.get(oppositeKey);
-    if (index != opp)
+    if (index != null && (!index.equals(opp)))
       index += pushType == ListDirection.LEFT ? -1 : 1; // Subtract index if left push, add if right
                                                         // push
 
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneFileRegionColocationListener.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneFileRegionColocationListener.java
index 7298283..7db90cb 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneFileRegionColocationListener.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneFileRegionColocationListener.java
@@ -41,7 +41,8 @@ public class LuceneFileRegionColocationListener implements ColocationListener {
 
   @Override
   public boolean equals(Object obj) {
-    return (obj instanceof LuceneFileRegionColocationListener
-        && ((LuceneFileRegionColocationListener) obj).bucketID == this.bucketID);
+    return (obj != null && obj instanceof LuceneFileRegionColocationListener
+        && ((LuceneFileRegionColocationListener) obj).bucketID != null
+        && ((LuceneFileRegionColocationListener) obj).bucketID.equals(this.bucketID));
   }
 }