Reduce SAT warnings

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
pull/4567/head
Holger Friedrich 2025-01-19 14:15:05 +01:00
parent 6922d60fd9
commit 432ce99662
5 changed files with 8 additions and 32 deletions

View File

@ -89,38 +89,22 @@ public class CompareConditionHandler extends BaseConditionModuleHandler {
case "GT":
case ">":
// Greater
if (toCompare == null) {
return false;
} else {
return compare(toCompare, rightValue) > 0;
}
return (toCompare != null) && (compare(toCompare, rightValue) > 0);
case "gte":
case "GTE":
case ">=":
case "=>":
// Greater or equal
if (toCompare == null) {
return false;
} else {
return compare(toCompare, rightValue) >= 0;
}
return (toCompare != null) && (compare(toCompare, rightValue) >= 0);
case "lt":
case "LT":
case "<":
if (toCompare == null) {
return false;
} else {
return compare(toCompare, rightValue) < 0;
}
return (toCompare != null) && (compare(toCompare, rightValue) < 0);
case "lte":
case "LTE":
case "<=":
case "=<":
if (toCompare == null) {
return false;
} else {
return compare(toCompare, rightValue) <= 0;
}
return (toCompare != null) && (compare(toCompare, rightValue) <= 0);
case "matches":
// Matcher...
if (toCompare instanceof String string1 && rightValue instanceof String string2) {

View File

@ -16,7 +16,6 @@ import java.time.Duration;
import java.time.Instant;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.library.types.DateTimeType;
import org.openhab.core.thing.profiles.ProfileCallback;
import org.openhab.core.thing.profiles.ProfileContext;
@ -63,10 +62,6 @@ public class TimestampOffsetProfile implements StateProfile {
}
}
private @Nullable String toStringOrNull(@Nullable Object value) {
return value == null ? null : value.toString();
}
@Override
public ProfileTypeUID getProfileTypeUID() {
return SystemProfiles.TIMESTAMP_OFFSET;

View File

@ -60,7 +60,7 @@ public class ThreadedEventHandler implements Closeable {
logger.trace("inspect event: {}", event);
if (event == null) {
logger.debug("Hey, you have really very few events.");
} else if (event.equals(notifyEvent)) {
} else if (event.equals(notifyEvent)) { // NOPMD
// received an internal notification
} else {
worker.handleEvent(event);

View File

@ -591,7 +591,7 @@ public class SafeCallerImplTest extends JavaTest {
@Override
public void run() {
try {
super.run();
super.run(); // NOPMD
} catch (AssertionError e) {
AssertingThread.this.assertionError = e;
} catch (RuntimeException e) {

View File

@ -1,13 +1,9 @@
org.openhab.core.common.registry.AbstractRegistry=AvoidCatchingThrowable
org.openhab.core.internal.common.SafeCallManagerImpl=CompareObjectsWithEquals
org.openhab.core.internal.events.ThreadedEventHandler=CompareObjectsWithEquals
org.openhab.core.internal.events.ThreadedEventHandler=EmptyIfStmt
org.openhab.core.thing.internal.ChannelItemProvider=CompareObjectsWithEquals
org.openhab.core.thing.internal.ThingManager=CompareObjectsWithEquals
org.openhab.core.io.console.karaf.internal.OSGiConsole=SystemPrintln
org.openhab.core.io.console.rfc147.internal.CommandWrapper=SystemPrintln
org.openhab.core.io.console.rfc147.internal.OSGiConsole=SystemPrintln
org.openhab.core.io.net.http.internal.SecureHttpClientFactory=AvoidThrowingRawExceptionTypes
org.openhab.core.io.transport.modbus.internal.ModbusManagerImpl=MoreThanOneLogger
org.openhab.core.model.core.internal.ModelRepositoryImpl=AvoidCatchingNPE
org.openhab.core.model.script.interpreter.ScriptInterpreter=AvoidCatchingThrowable
org.openhab.core.ui.internal.proxy.ProxyServletService=AvoidCatchingThrowable
@ -16,3 +12,4 @@ org.openhab.core.automation.internal.RuleRegistryImpl=CompareObjectsWithEquals
org.openhab.core.automation.internal.provider.AutomationResourceBundlesEventQueue=AvoidCatchingThrowable
org.openhab.core.io.console.karaf.internal.InstallServiceCommand=SystemPrintln
org.openhab.core.common.PoolBasedSequentialScheduledExecutorService=CompareObjectsWithEquals
org.openhab.core.tools.UpgradeTool=SystemPrintln