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:
Wouter Born
2021-05-05 21:06:04 +02:00
committed by GitHub
parent 582ef280e5
commit f5f922eaf4
14 changed files with 34 additions and 43 deletions

View File

@@ -131,6 +131,7 @@ public class PhonebookProfile implements StateProfile {
}
@Override
@SuppressWarnings("PMD.CompareObjectsWithEquals")
public void onStateUpdateFromHandler(State state) {
if (state instanceof UnDefType) {
// we cannot adjust UNDEF or NULL values, thus we simply apply them without reporting an error or warning
@@ -139,6 +140,7 @@ public class PhonebookProfile implements StateProfile {
if (state instanceof StringType) {
Optional<String> match = resolveNumber(state.toString());
State newState = match.map(name -> (State) new StringType(name)).orElse(state);
// Compare by reference to check if the name is mapped to the same state
if (newState == state) {
logger.debug("Number '{}' not found in phonebook '{}' from provider '{}'", state, phonebookName,
thingUID);