flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject flink git commit: [core] Use consistent equality check in Value types
Date Mon, 22 Jun 2015 09:06:17 GMT
Repository: flink
Updated Branches:
  refs/heads/master cdde553c0 -> 3406d96e9


[core] Use consistent equality check in Value types

This closes #849, #850.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/3406d96e
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/3406d96e
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/3406d96e

Branch: refs/heads/master
Commit: 3406d96e92777f63b5a01485e863dad820e3c35e
Parents: cdde553
Author: sahitya-pavurala <sp3133@nyu.edu>
Authored: Wed Jun 17 14:06:58 2015 -0700
Committer: Ufuk Celebi <uce@apache.org>
Committed: Mon Jun 22 11:05:34 2015 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/flink/types/BooleanValue.java      | 5 ++---
 flink-core/src/main/java/org/apache/flink/types/ByteValue.java  | 2 +-
 flink-core/src/main/java/org/apache/flink/types/CharValue.java  | 2 +-
 .../src/main/java/org/apache/flink/types/DoubleValue.java       | 2 +-
 flink-core/src/main/java/org/apache/flink/types/FloatValue.java | 2 +-
 flink-core/src/main/java/org/apache/flink/types/IntValue.java   | 2 +-
 flink-core/src/main/java/org/apache/flink/types/LongValue.java  | 4 ++--
 flink-core/src/main/java/org/apache/flink/types/ShortValue.java | 2 +-
 .../src/main/java/org/apache/flink/types/StringValue.java       | 2 +-
 9 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/3406d96e/flink-core/src/main/java/org/apache/flink/types/BooleanValue.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/types/BooleanValue.java b/flink-core/src/main/java/org/apache/flink/types/BooleanValue.java
index d6f91aa..5209a17 100644
--- a/flink-core/src/main/java/org/apache/flink/types/BooleanValue.java
+++ b/flink-core/src/main/java/org/apache/flink/types/BooleanValue.java
@@ -89,11 +89,10 @@ public class BooleanValue implements NormalizableKey<BooleanValue>,
ResettableVa
 	
 	@Override
 	public boolean equals(Object obj) {
-		if (obj.getClass() == BooleanValue.class) {
+		if (obj != null && obj.getClass() == BooleanValue.class) {
 			return ((BooleanValue) obj).value == this.value;
-		} else {
-			return false;
 		}
+		return false;
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/flink/blob/3406d96e/flink-core/src/main/java/org/apache/flink/types/ByteValue.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/types/ByteValue.java b/flink-core/src/main/java/org/apache/flink/types/ByteValue.java
index c2f1f10..10c2eda 100644
--- a/flink-core/src/main/java/org/apache/flink/types/ByteValue.java
+++ b/flink-core/src/main/java/org/apache/flink/types/ByteValue.java
@@ -108,7 +108,7 @@ public class ByteValue implements NormalizableKey<ByteValue>, ResettableValue<By
 
 	@Override
 	public boolean equals(final Object obj) {
-		if (obj instanceof ByteValue) {
+		if (obj != null && obj.getClass() == ByteValue.class) {
 			return ((ByteValue) obj).value == this.value;
 		}
 		return false;

http://git-wip-us.apache.org/repos/asf/flink/blob/3406d96e/flink-core/src/main/java/org/apache/flink/types/CharValue.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/types/CharValue.java b/flink-core/src/main/java/org/apache/flink/types/CharValue.java
index 3fd9f29..30e758e 100644
--- a/flink-core/src/main/java/org/apache/flink/types/CharValue.java
+++ b/flink-core/src/main/java/org/apache/flink/types/CharValue.java
@@ -108,7 +108,7 @@ public class CharValue implements NormalizableKey<CharValue>, ResettableValue<Ch
 
 	@Override
 	public boolean equals(final Object obj) {
-		if (obj instanceof CharValue) {
+		if (obj != null && obj.getClass() == CharValue.class) {
 			return ((CharValue) obj).value == this.value;
 		}
 		return false;

http://git-wip-us.apache.org/repos/asf/flink/blob/3406d96e/flink-core/src/main/java/org/apache/flink/types/DoubleValue.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/types/DoubleValue.java b/flink-core/src/main/java/org/apache/flink/types/DoubleValue.java
index e49afd9..0472fc8 100644
--- a/flink-core/src/main/java/org/apache/flink/types/DoubleValue.java
+++ b/flink-core/src/main/java/org/apache/flink/types/DoubleValue.java
@@ -109,7 +109,7 @@ public class DoubleValue implements Key<DoubleValue>, ResettableValue<DoubleValu
 
 	@Override
 	public boolean equals(final Object obj) {
-		if (obj.getClass() == DoubleValue.class) {
+		if (obj != null && obj.getClass() == DoubleValue.class) {
 			final DoubleValue other = (DoubleValue) obj;
 			return Double.doubleToLongBits(this.value) == Double.doubleToLongBits(other.value);
 		}

http://git-wip-us.apache.org/repos/asf/flink/blob/3406d96e/flink-core/src/main/java/org/apache/flink/types/FloatValue.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/types/FloatValue.java b/flink-core/src/main/java/org/apache/flink/types/FloatValue.java
index bc3a447..8026ac9 100644
--- a/flink-core/src/main/java/org/apache/flink/types/FloatValue.java
+++ b/flink-core/src/main/java/org/apache/flink/types/FloatValue.java
@@ -108,7 +108,7 @@ public class FloatValue implements Key<FloatValue>, ResettableValue<FloatValue>,
 
 	@Override
 	public boolean equals(final Object obj) {
-		if (obj.getClass() == FloatValue.class) {
+		if (obj != null && obj.getClass() == FloatValue.class) {
 			final FloatValue other = (FloatValue) obj;
 			return Float.floatToIntBits(this.value) == Float.floatToIntBits(other.value);
 		}

http://git-wip-us.apache.org/repos/asf/flink/blob/3406d96e/flink-core/src/main/java/org/apache/flink/types/IntValue.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/types/IntValue.java b/flink-core/src/main/java/org/apache/flink/types/IntValue.java
index 423c8c1..93f70ca 100644
--- a/flink-core/src/main/java/org/apache/flink/types/IntValue.java
+++ b/flink-core/src/main/java/org/apache/flink/types/IntValue.java
@@ -108,7 +108,7 @@ public class IntValue implements NormalizableKey<IntValue>, ResettableValue<IntV
 
 	@Override
 	public boolean equals(final Object obj) {
-		if (obj instanceof IntValue) {
+		if (obj != null && obj.getClass() == IntValue.class) {
 			return ((IntValue) obj).value == this.value;
 		}
 		return false;

http://git-wip-us.apache.org/repos/asf/flink/blob/3406d96e/flink-core/src/main/java/org/apache/flink/types/LongValue.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/types/LongValue.java b/flink-core/src/main/java/org/apache/flink/types/LongValue.java
index b9841f7..981ba8f 100644
--- a/flink-core/src/main/java/org/apache/flink/types/LongValue.java
+++ b/flink-core/src/main/java/org/apache/flink/types/LongValue.java
@@ -116,8 +116,8 @@ public class LongValue implements NormalizableKey<LongValue>, ResettableValue<Lo
 	 */
 	@Override
 	public boolean equals(final Object obj) {
-		if (obj != null & obj instanceof LongValue) {
-			return this.value == ((LongValue) obj).value;
+		if (obj != null && obj.getClass() == LongValue.class) {
+			return ((LongValue) obj).value == this.value;
 		}
 		return false;
 	}

http://git-wip-us.apache.org/repos/asf/flink/blob/3406d96e/flink-core/src/main/java/org/apache/flink/types/ShortValue.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/types/ShortValue.java b/flink-core/src/main/java/org/apache/flink/types/ShortValue.java
index ec03497..8688b02 100644
--- a/flink-core/src/main/java/org/apache/flink/types/ShortValue.java
+++ b/flink-core/src/main/java/org/apache/flink/types/ShortValue.java
@@ -108,7 +108,7 @@ public class ShortValue implements NormalizableKey<ShortValue>,
ResettableValue<
 
 	@Override
 	public boolean equals(final Object obj) {
-		if (obj instanceof ShortValue) {
+		if (obj != null && obj.getClass() == ShortValue.class) {
 			return ((ShortValue) obj).value == this.value;
 		}
 		return false;

http://git-wip-us.apache.org/repos/asf/flink/blob/3406d96e/flink-core/src/main/java/org/apache/flink/types/StringValue.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/types/StringValue.java b/flink-core/src/main/java/org/apache/flink/types/StringValue.java
index f76ace3..8d4a878 100644
--- a/flink-core/src/main/java/org/apache/flink/types/StringValue.java
+++ b/flink-core/src/main/java/org/apache/flink/types/StringValue.java
@@ -581,7 +581,7 @@ public class StringValue implements NormalizableKey<StringValue>,
CharSequence,
 			return true;
 		}
 		
-		if (obj.getClass() == StringValue.class) {
+		if (obj != null && obj.getClass() == StringValue.class) {
 			final StringValue other = (StringValue) obj;
 			int len = this.len;
 			


Mime
View raw message