forked from j62/ctbrec
1
0
Fork 0

Fix equals and hashcode

equals and hashcode used the path field, which is empty for old
recordings. Fixed by using getAbsoluteFile() instead
This commit is contained in:
0xb00bface 2020-09-26 18:10:16 +02:00
parent 93deeb3e52
commit f575958fe9
1 changed files with 2 additions and 6 deletions

View File

@ -220,7 +220,7 @@ public class Recording implements Serializable {
int result = 1;
result = prime * result + ((getStartDate() == null) ? 0 : (int) (getStartDate().toEpochMilli() ^ (getStartDate().toEpochMilli() >>> 32)));
result = prime * result + ((model == null) ? 0 : model.hashCode());
result = prime * result + ((path == null) ? 0 : path.hashCode());
result = prime * result + ((getAbsoluteFile() == null) ? 0 : getAbsoluteFile().hashCode());
return result;
}
@ -241,11 +241,7 @@ public class Recording implements Serializable {
} else if (!getModel().equals(other.getModel())) {
return false;
}
if (path == null) {
if (other.path != null) {
return false;
}
} else if (!path.equals(other.path)) {
if (!getAbsoluteFile().equals(other.getAbsoluteFile())) {
return false;
}
if (getStartDate() == null) {