Reduce SAT warnings (#4567)
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>pull/4561/head
parent
4ec2b3c457
commit
ab870d73df
|
@ -89,38 +89,22 @@ public class CompareConditionHandler extends BaseConditionModuleHandler {
|
||||||
case "GT":
|
case "GT":
|
||||||
case ">":
|
case ">":
|
||||||
// Greater
|
// Greater
|
||||||
if (toCompare == null) {
|
return (toCompare != null) && (compare(toCompare, rightValue) > 0);
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return compare(toCompare, rightValue) > 0;
|
|
||||||
}
|
|
||||||
case "gte":
|
case "gte":
|
||||||
case "GTE":
|
case "GTE":
|
||||||
case ">=":
|
case ">=":
|
||||||
case "=>":
|
case "=>":
|
||||||
// Greater or equal
|
// Greater or equal
|
||||||
if (toCompare == null) {
|
return (toCompare != null) && (compare(toCompare, rightValue) >= 0);
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return compare(toCompare, rightValue) >= 0;
|
|
||||||
}
|
|
||||||
case "lt":
|
case "lt":
|
||||||
case "LT":
|
case "LT":
|
||||||
case "<":
|
case "<":
|
||||||
if (toCompare == null) {
|
return (toCompare != null) && (compare(toCompare, rightValue) < 0);
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return compare(toCompare, rightValue) < 0;
|
|
||||||
}
|
|
||||||
case "lte":
|
case "lte":
|
||||||
case "LTE":
|
case "LTE":
|
||||||
case "<=":
|
case "<=":
|
||||||
case "=<":
|
case "=<":
|
||||||
if (toCompare == null) {
|
return (toCompare != null) && (compare(toCompare, rightValue) <= 0);
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return compare(toCompare, rightValue) <= 0;
|
|
||||||
}
|
|
||||||
case "matches":
|
case "matches":
|
||||||
// Matcher...
|
// Matcher...
|
||||||
if (toCompare instanceof String string1 && rightValue instanceof String string2) {
|
if (toCompare instanceof String string1 && rightValue instanceof String string2) {
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
|
||||||
import org.openhab.core.library.types.DateTimeType;
|
import org.openhab.core.library.types.DateTimeType;
|
||||||
import org.openhab.core.thing.profiles.ProfileCallback;
|
import org.openhab.core.thing.profiles.ProfileCallback;
|
||||||
import org.openhab.core.thing.profiles.ProfileContext;
|
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
|
@Override
|
||||||
public ProfileTypeUID getProfileTypeUID() {
|
public ProfileTypeUID getProfileTypeUID() {
|
||||||
return SystemProfiles.TIMESTAMP_OFFSET;
|
return SystemProfiles.TIMESTAMP_OFFSET;
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class ThreadedEventHandler implements Closeable {
|
||||||
logger.trace("inspect event: {}", event);
|
logger.trace("inspect event: {}", event);
|
||||||
if (event == null) {
|
if (event == null) {
|
||||||
logger.debug("Hey, you have really very few events.");
|
logger.debug("Hey, you have really very few events.");
|
||||||
} else if (event.equals(notifyEvent)) {
|
} else if (event.equals(notifyEvent)) { // NOPMD
|
||||||
// received an internal notification
|
// received an internal notification
|
||||||
} else {
|
} else {
|
||||||
worker.handleEvent(event);
|
worker.handleEvent(event);
|
||||||
|
|
|
@ -591,7 +591,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
super.run();
|
super.run(); // NOPMD
|
||||||
} catch (AssertionError e) {
|
} catch (AssertionError e) {
|
||||||
AssertingThread.this.assertionError = e;
|
AssertingThread.this.assertionError = e;
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
org.openhab.core.common.registry.AbstractRegistry=AvoidCatchingThrowable
|
org.openhab.core.common.registry.AbstractRegistry=AvoidCatchingThrowable
|
||||||
org.openhab.core.internal.common.SafeCallManagerImpl=CompareObjectsWithEquals
|
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.karaf.internal.OSGiConsole=SystemPrintln
|
||||||
org.openhab.core.io.console.rfc147.internal.CommandWrapper=SystemPrintln
|
org.openhab.core.io.console.rfc147.internal.CommandWrapper=SystemPrintln
|
||||||
org.openhab.core.io.console.rfc147.internal.OSGiConsole=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.core.internal.ModelRepositoryImpl=AvoidCatchingNPE
|
||||||
org.openhab.core.model.script.interpreter.ScriptInterpreter=AvoidCatchingThrowable
|
org.openhab.core.model.script.interpreter.ScriptInterpreter=AvoidCatchingThrowable
|
||||||
org.openhab.core.ui.internal.proxy.ProxyServletService=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.automation.internal.provider.AutomationResourceBundlesEventQueue=AvoidCatchingThrowable
|
||||||
org.openhab.core.io.console.karaf.internal.InstallServiceCommand=SystemPrintln
|
org.openhab.core.io.console.karaf.internal.InstallServiceCommand=SystemPrintln
|
||||||
org.openhab.core.common.PoolBasedSequentialScheduledExecutorService=CompareObjectsWithEquals
|
org.openhab.core.common.PoolBasedSequentialScheduledExecutorService=CompareObjectsWithEquals
|
||||||
|
org.openhab.core.tools.UpgradeTool=SystemPrintln
|
||||||
|
|
Loading…
Reference in New Issue