Uploaded image for project: 'Jackrabbit FileVault'
  1. Jackrabbit FileVault
  2. JCRVLT-454

FilterSet equals method does not include ImportMode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.4.4
    • None
    • vlt
    • None

    Description

      In the current implementation two filters definitions are equal:
      <filter root="/etc/map" mode="replace" />
      <filter root="/etc/map" mode="update" />
      Only entries and root are used to calculate hashcode and equals comparisons:

      https://github.com/apache/jackrabbit-filevault/blob/0a4e5b89d67be926029c388bdb81e84d4b341222/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/api/FilterSet.java#L284

      The solution could be:

      public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof FilterSet)) return false;
            FilterSet filterSet = (FilterSet) o;
            // importMode is @NotNull, can we depend on it? 
            if (!importMode.equals(filterSet.importMode)) return false; 
            if (entries != null ? !entries.equals(filterSet.entries) : filterSet.entries != null) return false;
            return root.equals(filterSet.root);
      } 
      public int hashCode() {
            int result = root.hashCode();
            // importMode is @NotNull, can we depend on it? 
            result = 31 * importMode.hashCode();
            result = 31 * result + (entries != null ? entries.hashCode() : 0);
            return result;
      } 

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            michalcukierman Michal Cukierman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: