Skip to content

Commit

Permalink
Reduce SAT warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
  • Loading branch information
holgerfriedrich committed Jan 11, 2025
1 parent 6dffaa6 commit 2878139
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ protected boolean remoteEnabled() {
try {
Configuration configuration = configurationAdmin.getConfiguration("org.openhab.addons", null);
Dictionary<String, Object> properties = configuration.getProperties();
if (properties == null) {
if (properties == null) { // NOPMD
// if we can't determine a set property, we use true (default is remote enabled)
return true;
}
Expand All @@ -312,7 +312,7 @@ protected boolean includeIncompatible() {
try {
Configuration configuration = configurationAdmin.getConfiguration("org.openhab.addons", null);
Dictionary<String, Object> properties = configuration.getProperties();
if (properties == null) {
if (properties == null) { // NOPMD
// if we can't determine a set property, we use false (default is show compatible only)
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public boolean isCompatible(@Nullable AudioFormat audioFormat) {
if (getBitRate() instanceof Integer bitRate && !bitRate.equals(audioFormat.getBitRate())) {
return false;
}
if (getFrequency() instanceof Long frequency && !frequency.equals(audioFormat.getFrequency())) {
if (getFrequency() instanceof Long frequency && !frequency.equals(audioFormat.getFrequency())) { // NOPMD
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
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;
Expand Down Expand Up @@ -63,10 +62,6 @@ public TimestampOffsetProfile(ProfileCallback callback, ProfileContext context)
}
}

private @Nullable String toStringOrNull(@Nullable Object value) {
return value == null ? null : value.toString();
}

@Override
public ProfileTypeUID getProfileTypeUID() {
return SystemProfiles.TIMESTAMP_OFFSET;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ public List<DialogRegistration> getDialogRegistrations() {
}

private boolean checkLocales(Set<Locale> supportedLocales, Locale locale) {
if (supportedLocales.isEmpty()) {
if (supportedLocales.isEmpty()) { // NOPMD
return true;
}
return supportedLocales.stream().anyMatch(sLocale -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ public AssertingThread(Runnable runnable) {
@Override
public void run() {
try {
super.run();
super.run(); // NOPMD
} catch (AssertionError e) {
AssertingThread.this.assertionError = e;
} catch (RuntimeException e) {
Expand Down
7 changes: 2 additions & 5 deletions tools/static-code-analysis/pmd/suppressions.properties
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit 2878139

Please sign in to comment.