geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [05/24] incubator-geode git commit: GEODE-1744: Fix probable bugs from == use
Date Tue, 16 Aug 2016 21:33:53 GMT
GEODE-1744: Fix probable bugs from == use

This closes #230


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/2daae4c0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/2daae4c0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/2daae4c0

Branch: refs/heads/feature/GEODE-1691
Commit: 2daae4c0c4e6d56e92e3c5324ad30fb749e128c9
Parents: 332521a
Author: gmeilen <gracemeilen@gmail.com>
Authored: Wed Aug 10 14:18:32 2016 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Fri Aug 12 16:14:45 2016 -0700

----------------------------------------------------------------------
 .../com/gemstone/gemfire/admin/AlertLevel.java  |  5 +-
 .../admin/jmx/internal/ManagedResourceType.java |  6 +-
 .../jmx/internal/RefreshNotificationType.java   | 10 ++-
 .../internal/DistributionConfigImpl.java        |  3 +-
 .../distributed/internal/StartupMessage.java    |  4 +-
 .../internal/membership/InternalRole.java       |  8 +--
 .../admin/remote/DistributionLocatorId.java     |  6 +-
 .../admin/statalerts/StatisticInfoImpl.java     |  4 +-
 .../internal/cache/CacheServerLauncher.java     | 11 +++-
 .../gemfire/internal/cache/DiskInitFile.java    |  2 +-
 .../DistTXStateProxyImplOnCoordinator.java      |  4 +-
 .../internal/cache/locks/TXLockToken.java       |  6 +-
 .../cache/xmlcache/CacheXmlGenerator.java       |  2 +-
 .../cli/AbstractCliAroundInterceptor.java       |  6 +-
 .../domain/FixedPartitionAttributesInfo.java    |  5 +-
 .../cli/domain/PartitionAttributesInfo.java     | 19 +++---
 .../cli/domain/RegionAttributesInfo.java        |  4 +-
 .../internal/cli/help/utils/HelpUtils.java      |  2 +-
 .../internal/cli/result/CommandResult.java      |  6 +-
 .../gemfire/admin/AlertLevelJUnitTest.java      | 64 ++++++++++++++++++++
 .../gemfire/cache/query/data/Portfolio.java     | 10 ++-
 .../gemfire/cache/query/data/PortfolioData.java |  7 +--
 .../gemfire/cache/query/data/PortfolioNoDS.java |  7 +--
 .../gemfire/cache/query/data/PortfolioPdx.java  |  7 +--
 .../functional/IUM6Bug32345ReJUnitTest.java     |  4 +-
 ...ndexWithSngleFrmAndMultCondQryJUnitTest.java |  6 +-
 .../functional/IumMultConditionJUnitTest.java   |  5 +-
 .../membership/InternalRoleJUnitTest.java       | 46 ++++++++++++++
 .../remote/DistributionLocatorIdJUnitTest.java  | 54 +++++++++++++++++
 .../cache/CacheServerLauncherJUnitTest.java     | 54 +++++++++++++++++
 .../internal/cache/TestNonSizerObject.java      |  4 +-
 .../fixed/FixedPartitioningTestBase.java        | 13 ++--
 .../FixedPartitioningTestBaseJUnitTest.java     | 63 +++++++++++++++++++
 .../security/GeodeSecurityUtilTest.java         |  3 +-
 .../AbstractCliAroundInterceptorJUnitTest.java  | 59 ++++++++++++++++++
 .../security/templates/XmlAuthorization.java    |  4 +-
 36 files changed, 439 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/admin/AlertLevel.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/admin/AlertLevel.java b/geode-core/src/main/java/com/gemstone/gemfire/admin/AlertLevel.java
index dec3e9d..fb4271d 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/admin/AlertLevel.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/admin/AlertLevel.java
@@ -145,9 +145,8 @@ public class AlertLevel implements java.io.Serializable {
 		final AlertLevel that = (AlertLevel) other;
 
 		if (this.severity != that.severity) return false;
-		if (this.name != that.name &&
-	  		!(this.name != null &&
-	  		this.name.equals(that.name))) return false;
+		if (this.name != null &&
+	  		!this.name.equals(that.name)) return false;
 
 		return true;
 	}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/ManagedResourceType.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/ManagedResourceType.java b/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/ManagedResourceType.java
index 69a70e2..65a908e 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/ManagedResourceType.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/ManagedResourceType.java
@@ -16,6 +16,8 @@
  */
 package com.gemstone.gemfire.admin.jmx.internal;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * Type-safe definition for ModelMBean managed resources.  The class type 
  * ({@link #getClassTypeName}) must match the fully qualified class name listed
@@ -176,9 +178,7 @@ public class ManagedResourceType implements java.io.Serializable {
 		if (!(other instanceof ManagedResourceType)) return  false;
 		final ManagedResourceType that = (ManagedResourceType) other;
 
-		if (this.name != that.name &&
-	  		!(this.name != null &&
-	  		this.name.equals(that.name))) return false;
+		if (!StringUtils.equals(this.name, that.name)) return false;
 		if (this.clazz != that.clazz &&
 	  		!(this.clazz != null &&
 	  		this.clazz.equals(that.clazz))) return false;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/RefreshNotificationType.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/RefreshNotificationType.java b/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/RefreshNotificationType.java
index 3b4271d..d5e4c72 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/RefreshNotificationType.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/RefreshNotificationType.java
@@ -16,6 +16,8 @@
  */
 package com.gemstone.gemfire.admin.jmx.internal;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * Type-safe definition for refresh notifications.
  *
@@ -99,12 +101,8 @@ public class RefreshNotificationType implements java.io.Serializable {
 		if (!(other instanceof RefreshNotificationType)) return  false;
 		final RefreshNotificationType that = (RefreshNotificationType) other;
 
-		if (this.type != that.type &&
-	  		!(this.type != null &&
-	  		this.type.equals(that.type))) return false;
-		if (this.msg != that.msg &&
-	  		!(this.msg != null &&
-	  		this.msg.equals(that.msg))) return false;
+		if (!StringUtils.equals(this.type, that.type)) return false;
+		if (!StringUtils.equals(this.msg, that.msg)) return false;
 
 		return true;
 	}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java
index 72e53ff..fd4743b 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfigImpl.java
@@ -34,6 +34,7 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.geode.redis.GeodeRedisServer;
 
 import com.gemstone.gemfire.GemFireConfigException;
@@ -2860,7 +2861,7 @@ public class DistributionConfigImpl
         return false;
     } else if (!userDefinedProps.equals(other.userDefinedProps))
       return false;
-    if (securityEnabledComponents != other.securityEnabledComponents) {
+    if (!StringUtils.equals(securityEnabledComponents, other.securityEnabledComponents)) {
       return false;
     }
     return true;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessage.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessage.java
index ed78151..82f5c88 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessage.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/StartupMessage.java
@@ -24,6 +24,8 @@ import com.gemstone.gemfire.internal.InternalDataSerializer.SerializerAttributes
 import com.gemstone.gemfire.internal.InternalInstantiator.InstantiatorAttributesHolder;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.LogService;
+
+import org.apache.commons.lang.StringUtils;
 import org.apache.logging.log4j.Logger;
 
 import java.io.DataInput;
@@ -288,7 +290,7 @@ public final class StartupMessage extends HighPriorityDistributionMessage implem
     if (myMcastAddr != null) {
       myMcastHostAddr = myMcastAddr.getHostAddress();
     }
-    if (myMcastHostAddr == otherMcastHostAddr) return true;
+    if (StringUtils.equals(myMcastHostAddr,otherMcastHostAddr)) return true;
     if (myMcastHostAddr == null) return false;
     return myMcastHostAddr.equals(otherMcastHostAddr);
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalRole.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalRole.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalRole.java
index 69d0ad4..62ba859 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalRole.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/InternalRole.java
@@ -23,6 +23,8 @@ import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 
 import java.util.*;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * <p>Members of the distributed system can fill one or more user defined 
  * roles. A role is metadata that describes how the member relates to other 
@@ -52,7 +54,7 @@ public class InternalRole implements Role {
   private static final Map roles = new HashMap(); // could use ConcurrentHashMap
   
   /** Contructs a new InternalRole instance for the specified role name */
-  private InternalRole(String name) {
+  InternalRole(String name) {
     this.name = name;
   }
   
@@ -94,9 +96,7 @@ public class InternalRole implements Role {
 		if (!(other instanceof InternalRole)) return  false;
 		final InternalRole that = (InternalRole) other;
 
-		if (this.name != that.name &&
-	  		!(this.name != null &&
-	  		this.name.equals(that.name))) return false;
+		if (!StringUtils.equals(this.name, that.name)) return false;
 
 		return true;
 	}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/DistributionLocatorId.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/DistributionLocatorId.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/DistributionLocatorId.java
index 87fa715..1459d89 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/DistributionLocatorId.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/remote/DistributionLocatorId.java
@@ -30,6 +30,8 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * Identifies the host, port, and bindAddress a distribution locator is 
  * listening on.
@@ -316,9 +318,7 @@ public class DistributionLocatorId implements java.io.Serializable {
 	  	  !(this.host != null &&
 	  	  this.host.equals(that.host))) return false;
 	  if (this.port != that.port) return false;
-	  if (this.bindAddress != that.bindAddress &&
-	  	  !(this.bindAddress != null &&
-	  	  this.bindAddress.equals(that.bindAddress))) return false;
+	  if (!StringUtils.equals(this.bindAddress, that.bindAddress)) return false;
 
 	  return true;
 	}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/statalerts/StatisticInfoImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/statalerts/StatisticInfoImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/statalerts/StatisticInfoImpl.java
index 41c1bc0..f66bbff 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/statalerts/StatisticInfoImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/admin/statalerts/StatisticInfoImpl.java
@@ -20,6 +20,8 @@ import java.io.DataOutput;
 import java.io.DataInput;
 import java.io.IOException;
 
+import org.apache.commons.lang.StringUtils;
+
 import com.gemstone.gemfire.StatisticDescriptor;
 import com.gemstone.gemfire.Statistics;
 import com.gemstone.gemfire.StatisticsFactory;
@@ -100,7 +102,7 @@ public class StatisticInfoImpl implements StatisticInfo {
 
     StatisticInfoImpl other = (StatisticInfoImpl)object;
 
-    if (getStatisticName() == other.getStatisticName()
+    if (StringUtils.equals(getStatisticName(), other.getStatisticName())
         && statisticsTextId != null
         && statisticsTextId.equals(other.getStatisticsTextId())) {
       return true;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheServerLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheServerLauncher.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheServerLauncher.java
index e8c6643..17875bf 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheServerLauncher.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheServerLauncher.java
@@ -1364,7 +1364,7 @@ public class CacheServerLauncher  {
           //this should not happen.
           break;
         }
-        if(running && lastLogMessage != status.dsMsg) {
+        if(running && safeEquals(lastLogMessage, status.dsMsg)) {
           status.dsMsg = lastLogMessage;
           try {
             writeStatus(status);
@@ -1377,4 +1377,13 @@ public class CacheServerLauncher  {
       }
     }
   }
+  protected static boolean safeEquals(String lastLogMessage, String dsMsg) {
+    if (lastLogMessage == null && dsMsg == null){
+      return true;
+    }
+    else if (lastLogMessage == null || dsMsg == null){
+      return false;
+    }
+    return lastLogMessage.equals(dsMsg);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskInitFile.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskInitFile.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskInitFile.java
index c6533a5..0d8ff05 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskInitFile.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskInitFile.java
@@ -2790,7 +2790,7 @@ public class DiskInitFile implements DiskInitFileInterpreter {
       }
     }
     if (compressorClassNameOption != null) {
-      compressorClassName = (compressorClassNameOption == "" ? null : compressorClassNameOption);
+      compressorClassName = (compressorClassNameOption.isEmpty() ? null : compressorClassNameOption);
     }
     if (statisticsEnabledOption != null) {
       statisticsEnabled = Boolean.parseBoolean(statisticsEnabledOption);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistTXStateProxyImplOnCoordinator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistTXStateProxyImplOnCoordinator.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistTXStateProxyImplOnCoordinator.java
index 67d63b1..df3359c 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistTXStateProxyImplOnCoordinator.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DistTXStateProxyImplOnCoordinator.java
@@ -791,7 +791,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
             + dm.getId() + " ,sortedRegions=" + sortedRegionName
             + " ,entryEventList=" + printEntryEventList(entryEventList)
             + " ,txEntryEventMap=" + printEntryEventMap(this.txEntryEventMap)
-            + " ,result= " + localResultMsg != null + " ,finalResult-old= "
+            + " ,result= " + (localResultMsg != null) + " ,finalResult-old= "
             + finalResult);
       }
       finalResult = finalResult && (localResultMsg != null);
@@ -832,7 +832,7 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
         if (logger.isDebugEnabled()) { // TODO - make this trace level
           logger
               .debug("DistTXStateProxyImplOnCoordinator.doCommit got results from target = "
-                  + target + " ,result= " + remoteResultMsg != null
+                  + target + " ,result= " + (remoteResultMsg != null)
                   + " ,finalResult-old= " + finalResult);
         }
         finalResult = finalResult && remoteResultMsg != null;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/locks/TXLockToken.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/locks/TXLockToken.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/locks/TXLockToken.java
index 8411c87..2d1568e 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/locks/TXLockToken.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/locks/TXLockToken.java
@@ -22,6 +22,8 @@ import com.gemstone.gemfire.DataSerializer;
 //import com.gemstone.gemfire.cache.Region;
 import java.io.*;
 
+import org.apache.commons.lang.StringUtils;
+
 /** 
  * Represents one transaction lock.
  *
@@ -58,9 +60,7 @@ public class TXLockToken implements DataSerializable {
 		if (!(other instanceof TXLockToken)) return  false;
 		final TXLockToken that = (TXLockToken) other;
 
-		if (this.regionFullPath != that.regionFullPath &&
-	  		!(this.regionFullPath != null &&
-	  		this.regionFullPath.equals(that.regionFullPath))) return false;
+		if (!StringUtils.equals(this.regionFullPath, that.regionFullPath)) return false;
 		if (this.name != that.name &&
 	  		!(this.name != null &&
 	  		this.name.equals(that.name))) return false;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
index 8f604ba..5843af8 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
@@ -1035,7 +1035,7 @@ public class CacheXmlGenerator extends CacheXml implements XMLReader {
       }
       
       if(bridge.getBindAddress() != null) {
-        if (generateDefaults() || bridge.getBindAddress() != CacheServer.DEFAULT_BIND_ADDRESS)
+        if (generateDefaults() ||  !CacheServer.DEFAULT_BIND_ADDRESS.equals(bridge.getBindAddress()))
         atts.addAttribute("","",BIND_ADDRESS,"",bridge.getBindAddress());
       }
   

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/AbstractCliAroundInterceptor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/AbstractCliAroundInterceptor.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/AbstractCliAroundInterceptor.java
index 9b80072..94c8e2f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/AbstractCliAroundInterceptor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/AbstractCliAroundInterceptor.java
@@ -88,7 +88,7 @@ public abstract class AbstractCliAroundInterceptor implements CliAroundIntercept
       try {
         String userInput = interact(message);
 
-        if (userInput == null || userInput == "") {
+        if (isNullOrEmpty(userInput)) {
           return defaultResponse;
         }
         response = Response.fromString(userInput);
@@ -103,6 +103,10 @@ public abstract class AbstractCliAroundInterceptor implements CliAroundIntercept
     return response;
   }
 
+  protected boolean isNullOrEmpty(final String userInput) {
+    return userInput == null || userInput.isEmpty();
+  }
+
   protected static void info(String msg, Throwable th) {
     Gfsh gfsh = Gfsh.getCurrentInstance();
     if (gfsh != null) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/FixedPartitionAttributesInfo.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/FixedPartitionAttributesInfo.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/FixedPartitionAttributesInfo.java
index d8ae9b5..a4cb4b3 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/FixedPartitionAttributesInfo.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/FixedPartitionAttributesInfo.java
@@ -18,6 +18,9 @@ package com.gemstone.gemfire.management.internal.cli.domain;
 
 import java.io.Serializable;
 
+import io.netty.util.internal.StringUtil;
+import org.apache.commons.lang.StringUtils;
+
 import com.gemstone.gemfire.cache.FixedPartitionAttributes;
 
 public class FixedPartitionAttributesInfo implements Serializable{
@@ -40,7 +43,7 @@ public class FixedPartitionAttributesInfo implements Serializable{
 		if (obj instanceof FixedPartitionAttributesInfo) {
 			FixedPartitionAttributesInfo fpaInfo = (FixedPartitionAttributesInfo) obj;
 			return this.numBuckets == fpaInfo.getNumBuckets() &&
-					this.partitionName == fpaInfo.getPartitionName() &&
+						 StringUtils.equals(this.partitionName, fpaInfo.getPartitionName()) &&
 					this.isPrimary  == fpaInfo.isPrimary();
 						
 		} else {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/PartitionAttributesInfo.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/PartitionAttributesInfo.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/PartitionAttributesInfo.java
index 6f5ed4f..ca3127a 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/PartitionAttributesInfo.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/PartitionAttributesInfo.java
@@ -22,6 +22,9 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
+
+import org.apache.commons.lang.StringUtils;
 
 import com.gemstone.gemfire.cache.FixedPartitionAttributes;
 import com.gemstone.gemfire.cache.PartitionAttributes;
@@ -146,14 +149,14 @@ public class PartitionAttributesInfo implements Serializable {
   public boolean equals (Object obj) {
     if (obj instanceof PartitionAttributesInfo) {
       PartitionAttributesInfo paInfo = (PartitionAttributesInfo) obj;
-      return this.getColocatedWith() == paInfo.getColocatedWith()
-          && this.getLocalMaxMemory() == paInfo.getLocalMaxMemory()
-          && this.getPartitionResolverName() == paInfo.getPartitionResolverName()
-          && this.getRecoveryDelay()  == paInfo.getRecoveryDelay()
-          && this.getRedundantCopies() == paInfo.getRedundantCopies()
-          && this.getStartupRecoveryDelay() == paInfo.getStartupRecoveryDelay()
-          && this.getTotalNumBuckets()  == paInfo.getTotalNumBuckets()
-          && this.getFixedPartitionAttributesInfo().equals(paInfo.getFixedPartitionAttributesInfo());
+      return StringUtils.equals(this.getColocatedWith(), paInfo.getColocatedWith())
+             && this.getLocalMaxMemory() == paInfo.getLocalMaxMemory()
+             && StringUtils.equals(this.getPartitionResolverName(), paInfo.getPartitionResolverName())
+             && this.getRecoveryDelay()  == paInfo.getRecoveryDelay()
+             && this.getRedundantCopies() == paInfo.getRedundantCopies()
+             && this.getStartupRecoveryDelay() == paInfo.getStartupRecoveryDelay()
+             && this.getTotalNumBuckets()  == paInfo.getTotalNumBuckets()
+             && this.getFixedPartitionAttributesInfo().equals(paInfo.getFixedPartitionAttributesInfo());
     } else {
       return false;
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/RegionAttributesInfo.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/RegionAttributesInfo.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/RegionAttributesInfo.java
index 5a51b62..7021eef 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/RegionAttributesInfo.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/domain/RegionAttributesInfo.java
@@ -23,6 +23,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.lang.StringUtils;
+
 import com.gemstone.gemfire.cache.CacheListener;
 import com.gemstone.gemfire.cache.CacheLoader;
 import com.gemstone.gemfire.cache.CacheWriter;
@@ -330,7 +332,7 @@ public class RegionAttributesInfo implements Serializable{
 				nonDefaultAttributes.put(RegionAttributesNames.CLONING_ENABLED, Boolean.toString(cloningEnabled));
 			}
 			
-			if (compressorClassName != RegionAttributesDefault.COMPRESSOR_CLASS_NAME) {
+			if (!StringUtils.equals(RegionAttributesDefault.COMPRESSOR_CLASS_NAME,compressorClassName)) {
 			        nonDefaultAttributes.put(RegionAttributesNames.COMPRESSOR, compressorClassName);
 			}
 			

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/help/utils/HelpUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/help/utils/HelpUtils.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/help/utils/HelpUtils.java
index 88c01f0..e579574 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/help/utils/HelpUtils.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/help/utils/HelpUtils.java
@@ -400,7 +400,7 @@ public class HelpUtils {
   public static String buildOptionHelpText(Option option) {
       String temp = SyntaxConstants.OPTION_VALUE_SPECIFIER + VALUE_FIELD;
       if( (option.getValueSeparator() != null &&
-    	 option.getValueSeparator() != CliMetaData.ANNOTATION_NULL_VALUE &&
+    	 !CliMetaData.ANNOTATION_NULL_VALUE.equals(option.getValueSeparator()) &&
         !option.getValueSeparator().equals("")) || isCollectionOrArrayType(option.getDataType())) {
     	  temp += "(" + option.getValueSeparator() + VALUE_FIELD + ")*";
       }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/result/CommandResult.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/result/CommandResult.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/result/CommandResult.java
index d591e7e..addc036 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/result/CommandResult.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/result/CommandResult.java
@@ -83,9 +83,9 @@ public class CommandResult implements Result {
   //TODO -Abhishek - extract this code out in a FormatBuilder or PresentationBuilder??
   private void buildData() {
     try {
-      if (resultData.getType() == ResultData.TYPE_OBJECT) {
+      if (ResultData.TYPE_OBJECT.equals(resultData.getType())) {
         buildObjectResultOutput();
-      } else if (resultData.getType() == ResultData.TYPE_COMPOSITE) {
+      } else if (ResultData.TYPE_COMPOSITE.equals(resultData.getType())) {
         buildComposite();
       } else {
         GfJsonObject content = getContent();
@@ -96,7 +96,7 @@ public class CommandResult implements Result {
 
           RowGroup rowGroup = resultTable.newRowGroup();
           
-          if (resultData.getType() == ResultData.TYPE_TABULAR) {
+          if (ResultData.TYPE_TABULAR.equals(resultData.getType())) {
     //        resultTable.setColumnSeparator(" | ");
             resultTable.setColumnSeparator("   ");            
             resultTable.setTabularResult(true);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/admin/AlertLevelJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/admin/AlertLevelJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/admin/AlertLevelJUnitTest.java
new file mode 100644
index 0000000..22f3301
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/admin/AlertLevelJUnitTest.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.admin;
+
+import static com.gemstone.gemfire.internal.Assert.assertTrue;
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * AlertLevel Tester.
+ */
+@Category(UnitTest.class)
+public class AlertLevelJUnitTest {
+
+  /**
+   * Method: equals(Object other)
+   */
+
+  private AlertLevel alertLevel1 = AlertLevel.WARNING;
+  private AlertLevel alertLevel2 = AlertLevel.ERROR;
+  private AlertLevel alertLevel3 = AlertLevel.WARNING;
+
+
+  @Test
+  public void testEquals() throws Exception {
+    //TODO: Test goes here...
+    assertTrue(alertLevel1.equals(alertLevel3));
+    assertFalse(alertLevel1.equals(alertLevel2));
+    assertFalse(alertLevel1.equals(null));
+
+    Constructor<AlertLevel> constructor;
+    constructor = AlertLevel.class.getDeclaredConstructor(int.class, String.class);
+    constructor.setAccessible(true);
+    AlertLevel level = constructor.newInstance(AlertLevel.ERROR.getSeverity(), "ERROR");
+    assertEquals(level.getSeverity(), AlertLevel.ERROR.getSeverity());
+
+
+    AlertLevel level1 = constructor.newInstance(AlertLevel.ERROR.getSeverity(), new String("ERROR"));
+    assertEquals(level1.getName(), alertLevel2.getName());
+    assertTrue(level1.equals(alertLevel2));
+
+  }
+
+} 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/Portfolio.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/Portfolio.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/Portfolio.java
index ce0c046..4c14df8 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/Portfolio.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/Portfolio.java
@@ -30,8 +30,11 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.apache.commons.lang.StringUtils;
+
 import com.gemstone.gemfire.DataSerializable;
 import com.gemstone.gemfire.DataSerializer;
 import com.gemstone.gemfire.internal.Assert;
@@ -210,12 +213,7 @@ public class Portfolio implements Serializable, DataSerializable {
   }
   
   public boolean boolFunction(String strArg){
-      if(strArg=="active"){
-      return true;
-      }
-      else{
-          return false;
-      }
+    return "active".equals(strArg);
   }  //added by vikramj
   
   public int intFunction(int j) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioData.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioData.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioData.java
index eb5ae5e..d8085a3 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioData.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioData.java
@@ -109,12 +109,7 @@ public class PortfolioData implements Declarable, Serializable
 
   public boolean boolFunction(String strArg)
   {
-    if (strArg == "active") {
-      return true;
-    }
-    else {
-      return false;
-    }
+    return "active".equals(strArg);
   } // added by vikramj
 
   public int intFunction(int j)

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioNoDS.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioNoDS.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioNoDS.java
index f2ff4a9..53c391a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioNoDS.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioNoDS.java
@@ -201,12 +201,7 @@ public class PortfolioNoDS implements Serializable {
   }
   
   public boolean boolFunction(String strArg){
-      if(strArg=="active"){
-      return true;
-      }
-      else{
-          return false;
-      }
+    return "active".equals(strArg);
   }  //added by vikramj
   
   public int intFunction(int j) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioPdx.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioPdx.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioPdx.java
index fa4e583..fb381f5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioPdx.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/data/PortfolioPdx.java
@@ -235,12 +235,7 @@ public class PortfolioPdx implements Serializable, PdxSerializable  {
   }
   
   public boolean boolFunction(String strArg){
-      if(strArg=="active"){
-      return true;
-      }
-      else{
-          return false;
-      }
+    return "active".equals(strArg);
   }  //added by vikramj
   
   public int intFunction(int j) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUM6Bug32345ReJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUM6Bug32345ReJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUM6Bug32345ReJUnitTest.java
index e01624a..696d5b7 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUM6Bug32345ReJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IUM6Bug32345ReJUnitTest.java
@@ -21,8 +21,10 @@ import static org.junit.Assert.fail;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Objects;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -197,7 +199,7 @@ public class IUM6Bug32345ReJUnitTest{
         fail("FAILED: In both the Cases the first member of StructSet i.e. Portfolio are different. ");
       if(stc2.get(strg2[1]) != stc1.get(strg1[1]))
         fail("FAILED: In both the cases Positions are different");
-      if(((Position)stc2.get(strg2[1])).secId != ((Position)stc1.get(strg1[1])).secId)
+      if(!StringUtils.equals(((Position) stc2.get(strg2[1])).secId, ((Position) stc1.get(strg1[1])).secId))
         fail("FAILED: In both the cases Positions secIds are different");
       if (((Portfolio)stc2.get(strg2[0])).isActive() != ((Portfolio)stc1.get(strg1[0])).isActive() )
         fail("FAILED: Status of the Portfolios found are different");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexWithSngleFrmAndMultCondQryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexWithSngleFrmAndMultCondQryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexWithSngleFrmAndMultCondQryJUnitTest.java
index 1f978ce..0087214 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexWithSngleFrmAndMultCondQryJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexWithSngleFrmAndMultCondQryJUnitTest.java
@@ -33,8 +33,10 @@ import static org.junit.Assert.fail;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Objects;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -202,7 +204,7 @@ public class IndexWithSngleFrmAndMultCondQryJUnitTest{
         fail("FAILED: In both the Cases the first member of StructSet i.e. Portfolio are different. ");
       if(stc2.get(strg2[1]) != stc1.get(strg1[1]))
         fail("FAILED: In both the cases Positions are different");
-      if(((Position)stc2.get(strg2[1])).secId != ((Position)stc1.get(strg1[1])).secId)
+      if(!StringUtils.equals(((Position) stc2.get(strg2[1])).secId, ((Position) stc1.get(strg1[1])).secId))
         fail("FAILED: In both the cases Positions secIds are different");
       if (((Portfolio)stc2.get(strg2[0])).isActive() != ((Portfolio)stc1.get(strg1[0])).isActive() )
         fail("FAILED: Status of the Portfolios found are different");
@@ -319,7 +321,7 @@ public class IndexWithSngleFrmAndMultCondQryJUnitTest{
         fail("FAILED: In both the Cases the first member of StructSet i.e. Portfolio are different. ");
       if(stc2.get(strg2[1]) != stc1.get(strg1[1]))
         fail("FAILED: In both the cases Positions are different");
-      if(((Position)stc2.get(strg2[1])).secId != ((Position)stc1.get(strg1[1])).secId)
+      if(!StringUtils.equals(((Position) stc2.get(strg2[1])).secId, ((Position) stc1.get(strg1[1])).secId))
         fail("FAILED: In both the cases Positions secIds are different");
       if (((Portfolio)stc2.get(strg2[0])).isActive() != ((Portfolio)stc1.get(strg1[0])).isActive() )
         fail("FAILED: Status of the Portfolios found are different");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IumMultConditionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IumMultConditionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IumMultConditionJUnitTest.java
index 913ca23..e6e6114 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IumMultConditionJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IumMultConditionJUnitTest.java
@@ -30,8 +30,10 @@ import static org.junit.Assert.fail;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Objects;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -199,8 +201,7 @@ public class IumMultConditionJUnitTest {
         fail("FAILED: In both the Cases the first member of StructSet i.e. Portfolio are different. ");
       if (stc2.get(strg2[1]) != stc1.get(strg1[1]))
         fail("FAILED: In both the cases Positions are different");
-      if (((Position) stc2.get(strg2[1])).secId != ((Position) stc1
-          .get(strg1[1])).secId)
+      if (!StringUtils.equals(((Position) stc2.get(strg2[1])).secId, ((Position) stc1.get(strg1[1])).secId))
         fail("FAILED: In both the cases Positions secIds are different");
       if (((Portfolio) stc2.get(strg2[0])).isActive() != ((Portfolio) stc1
           .get(strg1[0])).isActive())

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/InternalRoleJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/InternalRoleJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/InternalRoleJUnitTest.java
new file mode 100644
index 0000000..01d5998
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/InternalRoleJUnitTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.distributed.internal.membership;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.junit.Before; 
+import org.junit.After;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/** 
+* InternalRole Tester. 
+*/
+@Category(UnitTest.class)
+public class InternalRoleJUnitTest { 
+
+  @Test
+  public void testEquals(){
+    InternalRole role1 = new InternalRole("role1");
+    InternalRole role2 = role1;
+    InternalRole role3 = new InternalRole(new String("role1"));
+
+    assertEquals(role1, role2);
+    assertEquals(role1, role3);
+
+  }
+
+
+} 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/internal/admin/remote/DistributionLocatorIdJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/admin/remote/DistributionLocatorIdJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/admin/remote/DistributionLocatorIdJUnitTest.java
new file mode 100644
index 0000000..034ee9e
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/admin/remote/DistributionLocatorIdJUnitTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.admin.remote;
+
+import static com.gemstone.gemfire.internal.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import org.junit.Test;
+import org.junit.Before; 
+import org.junit.After;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/** 
+* DistributionLocatorId Tester. 
+*/
+@Category(UnitTest.class)
+public class DistributionLocatorIdJUnitTest {
+
+  @Test
+  public void testEquals() throws UnknownHostException {
+    InetAddress address = InetAddress.getLocalHost();
+    DistributionLocatorId dLI1 = new DistributionLocatorId(address, 40404, "127.0.0.1", null);
+    DistributionLocatorId dLI2 = dLI1;
+    @SuppressWarnings("RedundantStringConstructorCall")
+    DistributionLocatorId dLI3 = new DistributionLocatorId(address, 40404, new String("127.0.0.1"), null);
+    @SuppressWarnings("RedundantStringConstructorCall")
+    DistributionLocatorId dLI4 = new DistributionLocatorId(InetAddress.getByName("localhost"), 50505, new String("128.0.0.1"), null);
+
+    assertTrue(dLI1.equals(dLI2));
+    assertTrue(dLI1.equals(dLI3));
+    assertFalse(dLI1.equals(dLI4));
+
+  }
+
+} 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheServerLauncherJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheServerLauncherJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheServerLauncherJUnitTest.java
new file mode 100644
index 0000000..b7a2906
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/CacheServerLauncherJUnitTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache;
+
+import static com.gemstone.gemfire.internal.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+import org.junit.Test;
+import org.junit.Before; 
+import org.junit.After;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/** 
+* CacheServerLauncher Tester. 
+*/
+@Category(UnitTest.class)
+public class CacheServerLauncherJUnitTest {
+
+  @Test
+  public void testSafeEquals(){
+    String string1 = "string1";
+
+    String string2 = string1;
+
+    @SuppressWarnings("RedundantStringConstructorCall")
+    String string3 = new String(string1);
+
+    assertTrue(CacheServerLauncher.safeEquals(string1, string2));
+    assertTrue(CacheServerLauncher.safeEquals(string1, string3));
+    assertTrue(CacheServerLauncher.safeEquals(null, null));
+    assertFalse(CacheServerLauncher.safeEquals(null, string3));
+    assertFalse(CacheServerLauncher.safeEquals(string1, null));
+
+    
+  }
+
+
+} 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/TestNonSizerObject.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/TestNonSizerObject.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/TestNonSizerObject.java
index 81e6455..2537482 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/TestNonSizerObject.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/TestNonSizerObject.java
@@ -18,6 +18,8 @@ package com.gemstone.gemfire.internal.cache;
 
 import java.io.Serializable;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * Test object which does not implement ObjectSizer, used as Key/Value in put operation.
  * 
@@ -51,7 +53,7 @@ public class TestNonSizerObject implements Serializable {
   public boolean equals(Object obj) {
     if (obj instanceof TestNonSizerObject) {
       TestNonSizerObject other = (TestNonSizerObject)obj;
-      if (this.testString == other.testString) {
+      if (StringUtils.equals(this.testString, other.testString)) {
         return true;
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java
index 8a1a49c..a015376 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java
@@ -30,6 +30,7 @@ import java.util.Locale;
 import java.util.Properties;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.SystemFailure;
@@ -771,22 +772,22 @@ public class FixedPartitioningTestBase extends JUnit4DistributedTestCase {
       day = "0" + i;
     }
     else {
-      day = new Integer(i).toString();
+      day = Integer.toString(i);
     }
     String dateString = day + "-" + month + "-" + year;
     String DATE_FORMAT = "dd-MMM-yyyy";
     SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT, Locale.US);
     try {
-      if (dateType == "Date") {
+      if (StringUtils.equals(dateType,"Date")) {
         return sdf.parse(dateString);
       }
-      else if (dateType == "MyDate1") {
+      else if (StringUtils.equals(dateType, "MyDate1")) {
         return new MyDate1(sdf.parse(dateString).getTime());
       }
-      else if (dateType == "MyDate2") {
+      else if (StringUtils.equals(dateType, "MyDate2")) {
         return new MyDate2(sdf.parse(dateString).getTime());
       }
-      else if (dateType == "MyDate3") {
+      else if (StringUtils.equals(dateType,"MyDate3")) {
         return new MyDate3(sdf.parse(dateString).getTime());
       }
       else {
@@ -794,7 +795,7 @@ public class FixedPartitioningTestBase extends JUnit4DistributedTestCase {
       }
     }
     catch (ParseException e) {
-      com.gemstone.gemfire.test.dunit.Assert.fail("Exception Occured while parseing date", e);
+      com.gemstone.gemfire.test.dunit.Assert.fail("Exception occurred while parsing date", e);
     }
     return null;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBaseJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBaseJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBaseJUnitTest.java
new file mode 100644
index 0000000..8f9dbb6
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBaseJUnitTest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache.partitioned.fixed;
+
+import static org.junit.Assert.assertEquals;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Date;
+
+import org.junit.Test;
+import org.junit.Before; 
+import org.junit.After;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/** 
+* FixedPartitioningTestBase Tester. 
+*/
+@Category(UnitTest.class)
+public class FixedPartitioningTestBaseJUnitTest { 
+
+
+  @Test
+  @SuppressWarnings("RedundantStringConstructorCall")
+  public void testGenerateDate() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+
+    Class[] classes = {int.class, String.class, String.class};
+
+    Method method = FixedPartitioningTestBase.class.getDeclaredMethod("generateDate",classes);
+    method.setAccessible(true);
+    Date date = (Date)method.invoke(null, 5, "May", "MyDate1");
+    Date date1 = (Date)method.invoke(null, 5, "May", new String("MyDate1"));
+    assertEquals(date, date1);
+
+    date = (Date)method.invoke(null, 5, "May", "Date");
+    date1 = (Date)method.invoke(null, 5, "May", new String("Date"));
+    assertEquals(date, date1);
+
+    date = (Date)method.invoke(null, 5, "May", "MyDate2");
+    date1 = (Date)method.invoke(null, 5, "May", new String("MyDate2"));
+    assertEquals(date, date1);
+
+    date = (Date)method.invoke(null, 5, "May", "MyDate3");
+    date1 = (Date)method.invoke(null, 5, "May", new String("MyDate3"));
+    assertEquals(date, date1);
+  }
+} 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtilTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtilTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtilTest.java
index 23d0d99..6ab1d4b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtilTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtilTest.java
@@ -113,7 +113,8 @@ public class GeodeSecurityUtilTest {
     assertFalse(GeodeSecurityUtil.isIntegratedSecurity());
 
     assertTrue(GeodeSecurityUtil.isClientSecurityRequired());
-    assertFalse(GeodeSecurityUtil.isGatewaySecurityRequired());
+    assertTrue(GeodeSecurityUtil.isGatewaySecurityRequired());
+    
     assertFalse(GeodeSecurityUtil.isHttpServiceSecurityRequired());
     assertFalse(GeodeSecurityUtil.isJmxSecurityRequired());
     assertFalse(GeodeSecurityUtil.isPeerSecurityRequired());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/AbstractCliAroundInterceptorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/AbstractCliAroundInterceptorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/AbstractCliAroundInterceptorJUnitTest.java
new file mode 100644
index 0000000..19b7704
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/AbstractCliAroundInterceptorJUnitTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.management.internal.cli;
+
+import static com.gemstone.gemfire.internal.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.management.cli.Result;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * AbstractCliAroundInterceptor Tester.
+ */
+@Category(UnitTest.class)
+public class AbstractCliAroundInterceptorJUnitTest {
+
+  @Test
+  public void isNullOrEmpty()
+  {
+    AbstractCliAroundInterceptor interceptor = new AbstractCliAroundInterceptor() {
+      @Override
+      public Result preExecution(final GfshParseResult parseResult) {
+        return null;
+      }
+
+      @Override
+      public Result postExecution(final GfshParseResult parseResult, final Result commandResult) {
+        return null;
+      }
+    };
+    String empty = "";
+    @SuppressWarnings("RedundantStringConstructorCall")
+    String otherEmpty = new String(empty);  // create a new instance, not another reference
+
+    //noinspection StringEquality
+    assertFalse(empty == otherEmpty);
+    assertTrue(interceptor.isNullOrEmpty(empty));
+    assertTrue(interceptor.isNullOrEmpty(otherEmpty));
+    assertTrue(interceptor.isNullOrEmpty(null));
+    assertFalse(interceptor.isNullOrEmpty("not empty"));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2daae4c0/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlAuthorization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlAuthorization.java b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlAuthorization.java
index 50fc351..4349260 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlAuthorization.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlAuthorization.java
@@ -478,7 +478,7 @@ public class XmlAuthorization implements AccessControl {
         for (int userIndex = 0; userIndex < userNodes.getLength(); userIndex++) {
           final Node userNode = userNodes.item(userIndex);
 
-          if (userNode.getNodeName() == TAG_USER) {
+          if (TAG_USER.equals(userNode.getNodeName())) {
             final String userName = getNodeValue(userNode);
             HashSet<String> userRoleSet = XmlAuthorization.userRoles.get(userName);
             if (userRoleSet == null) {
@@ -511,7 +511,7 @@ public class XmlAuthorization implements AccessControl {
         for (int opIndex = 0; opIndex < operationNodes.getLength(); opIndex++) {
           final Node operationNode = operationNodes.item(opIndex);
 
-          if (operationNode.getNodeName() == TAG_OP) {
+          if (TAG_OP.equals(operationNode.getNodeName())) {
             final String operationName = getNodeValue(operationNode);
             final OperationCode code = OperationCode.valueOf(operationName);
 


Mime
View raw message