You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mh...@apache.org on 2019/06/27 16:59:18 UTC

[asterixdb] 01/03: [NO ISSUE][OTH] Use Absolute Path in FileReference hashCode/equals

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

mhubail pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 1f978819e3a86ae10d77d3211964145b68d9e05a
Author: Murtadha Hubail <mh...@apache.org>
AuthorDate: Fri Jun 7 06:38:50 2019 +0300

    [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 <mb...@apache.org>
    Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
---
 .../src/main/java/org/apache/hyracks/api/io/FileReference.java        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 @@ public final class FileReference implements Serializable {
         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();
     }
 
     /**