Fix/suppress PMD CompareObjectsWithEquals findings (#11476)

Newer PMD versions discover more CompareObjectsWithEquals findings.

Related to https://github.com/openhab/static-code-analysis/pull/423

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2021-11-02 10:43:53 +01:00
committed by GitHub
parent b67b9fcb25
commit 589400e223
82 changed files with 175 additions and 141 deletions

View File

@@ -13,6 +13,7 @@
package org.openhab.binding.dwdunwetter.internal.dto;
import java.util.Comparator;
import java.util.Objects;
/**
* Comperator to sort a Warning first by Severity, second by the onSet date.
@@ -28,7 +29,7 @@ public class SeverityComparator implements Comparator<DwdWarningData> {
int result = Integer.compare(o1.getSeverity().getOrder(), o2.getSeverity().getOrder());
if (result == 0) {
if (o1.getOnset() == o2.getOnset()) {
if (Objects.equals(o1.getOnset(), o2.getOnset())) {
return 0;
} else if (o1.getOnset() == null) {
return -1;