From f575958fe922e21ae068e50bee338d362c5ce7d5 Mon Sep 17 00:00:00 2001 From: 0xb00bface <0xboobface@gmail.com> Date: Sat, 26 Sep 2020 18:10:16 +0200 Subject: [PATCH] Fix equals and hashcode equals and hashcode used the path field, which is empty for old recordings. Fixed by using getAbsoluteFile() instead --- common/src/main/java/ctbrec/Recording.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/ctbrec/Recording.java b/common/src/main/java/ctbrec/Recording.java index 12559935..b95a10a3 100644 --- a/common/src/main/java/ctbrec/Recording.java +++ b/common/src/main/java/ctbrec/Recording.java @@ -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) {