Github user LosD commented on a diff in the pull request:

    https://github.com/apache/metamodel/pull/78#discussion_r47408930
  
    --- Diff: hadoop/src/main/java/org/apache/metamodel/util/HdfsResource.java 
---
    @@ -369,30 +307,19 @@ public Path getHadoopPath() {
     
         @Override
         public int hashCode() {
    -        return Arrays.hashCode(new Object[] { _filepath, _hostname, _port 
});
    +        return Objects.hash(_filepath, _hostname, _port, _hadoopConfDir);
         }
     
         @Override
         public boolean equals(Object obj) {
    -        if (this == obj)
    +        if (this == obj) {
                 return true;
    -        if (obj == null)
    -            return false;
    -        if (getClass() != obj.getClass())
    -            return false;
    -        HdfsResource other = (HdfsResource) obj;
    -        if (_filepath == null) {
    -            if (other._filepath != null)
    -                return false;
    -        } else if (!_filepath.equals(other._filepath))
    -            return false;
    -        if (_hostname == null) {
    -            if (other._hostname != null)
    -                return false;
    -        } else if (!_hostname.equals(other._hostname))
    -            return false;
    -        if (_port != other._port)
    -            return false;
    -        return true;
    +        }
    +        if (obj instanceof HdfsResource) {
    +            final HdfsResource other = (HdfsResource) obj;
    +            return Objects.equals(_filepath, other._filepath) && 
Objects.equals(_hostname, other._hostname)
    +                    && Objects.equals(_port, other._port) && 
Objects.equals(_hadoopConfDir, other._hadoopConfDir);
    +        }
    +        return false;
    --- End diff --
    
    Also a nice simplification. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to