Fixed equals() and hashCode() of RepositoryRole

This commit is contained in:
Philipp Czora
2019-01-29 10:25:12 +01:00
parent ec4fd48e1e
commit 5eb4d321a9

View File

@@ -1,5 +1,7 @@
package sonia.scm.security;
import org.apache.commons.collections.CollectionUtils;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
@@ -32,11 +34,11 @@ public class RepositoryRole {
if (!(o instanceof RepositoryRole)) return false;
RepositoryRole that = (RepositoryRole) o;
return name.equals(that.name) &&
verbs.equals(that.verbs);
CollectionUtils.isEqualCollection(this.verbs, that.verbs);
}
@Override
public int hashCode() {
return Objects.hash(name, verbs);
return Objects.hash(name, verbs.size());
}
}