Fixed erroneous equals() and hashCode()
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_dev_next@1252 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/comm/NetworkAddress.java b/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/comm/NetworkAddress.java
index d176c3c..563fdc1 100644
--- a/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/comm/NetworkAddress.java
+++ b/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/comm/NetworkAddress.java
@@ -15,6 +15,7 @@
package edu.uci.ics.hyracks.api.comm;
import java.io.Serializable;
+import java.util.Arrays;
public final class NetworkAddress implements Serializable {
private static final long serialVersionUID = 1L;
@@ -38,12 +39,12 @@
@Override
public String toString() {
- return ipAddress + ":" + port;
+ return Arrays.toString(ipAddress) + ":" + port;
}
@Override
public int hashCode() {
- return ipAddress.hashCode() + port;
+ return Arrays.hashCode(ipAddress) + port;
}
@Override
@@ -52,6 +53,6 @@
return false;
}
NetworkAddress on = (NetworkAddress) o;
- return on.port == port && on.ipAddress.equals(ipAddress);
+ return on.port == port && Arrays.equals(on.ipAddress, ipAddress);
}
}
\ No newline at end of file