Fix or suppress SAT CompareObjectsWithEquals findings (#10631)
* Fix or suppress SAT CompareObjectsWithEquals findings Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -14,6 +14,7 @@ package org.openhab.binding.bosesoundtouch.internal;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.openhab.core.types.StateOption;
|
||||
@@ -90,19 +91,19 @@ public class ContentItem {
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof ContentItem) {
|
||||
ContentItem other = (ContentItem) obj;
|
||||
if (!isEqual(other.source, this.source)) {
|
||||
if (!Objects.equals(other.source, this.source)) {
|
||||
return false;
|
||||
}
|
||||
if (!isEqual(other.sourceAccount, this.sourceAccount)) {
|
||||
if (!Objects.equals(other.sourceAccount, this.sourceAccount)) {
|
||||
return false;
|
||||
}
|
||||
if (other.presetable != this.presetable) {
|
||||
return false;
|
||||
}
|
||||
if (!isEqual(other.location, this.location)) {
|
||||
if (!Objects.equals(other.location, this.location)) {
|
||||
return false;
|
||||
}
|
||||
if (!isEqual(other.itemName, this.itemName)) {
|
||||
if (!Objects.equals(other.itemName, this.itemName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -265,14 +266,4 @@ public class ContentItem {
|
||||
// }
|
||||
return itemName;
|
||||
}
|
||||
|
||||
private boolean isEqual(String s1, String s2) {
|
||||
if (s1 == s2) {
|
||||
return true;
|
||||
}
|
||||
if (s1 == null || s2 == null) {
|
||||
return false;
|
||||
}
|
||||
return s1.equals(s2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user