[NO ISSUE][OTH] Use Absolute Path in FileReference hashCode/equals
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- To avoid cases where unintentional false comparison result happens
due to a relative path of one FileReference starting with "/" and
the other's does not, use the file absolute path in hashCode and
equals.
Change-Id: Idcb642b3c5396a8319dc0aaf050e8af6fca93039
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3430
Reviewed-by: Michael Blow <mblow@apache.org>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/FileReference.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/FileReference.java
index 4ded855..e4097ff 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/FileReference.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/FileReference.java
@@ -58,12 +58,12 @@
if (!(o instanceof FileReference)) {
return false;
}
- return path.equals(((FileReference) o).path) && dev.equals(((FileReference) o).dev);
+ return file.getAbsolutePath().equals(((FileReference) o).getAbsolutePath());
}
@Override
public int hashCode() {
- return path.hashCode();
+ return file.getAbsolutePath().hashCode();
}
/**