Reduce SAT warnings (#4339)

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
Holger Friedrich 2024-08-11 10:04:26 +02:00 committed by GitHub
parent 716045a174
commit fc454883c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 14 additions and 29 deletions

View File

@ -45,7 +45,7 @@ class GroupCommandTriggerHandlerTest extends JavaTest {
when(moduleMock.getId()).thenReturn("triggerId");
setupInterceptedLogger(GroupCommandTriggerHandler.class, LogLevel.WARN);
GroupCommandTriggerHandler handler = new GroupCommandTriggerHandler(moduleMock, "ruleId", contextMock,
GroupCommandTriggerHandler unused = new GroupCommandTriggerHandler(moduleMock, "ruleId", contextMock,
itemRegistryMock);
stopInterceptedLogger(GroupCommandTriggerHandler.class);
@ -61,7 +61,7 @@ class GroupCommandTriggerHandlerTest extends JavaTest {
when(moduleMock.getId()).thenReturn("triggerId");
setupInterceptedLogger(GroupCommandTriggerHandler.class, LogLevel.WARN);
GroupCommandTriggerHandler handler = new GroupCommandTriggerHandler(moduleMock, "ruleId", contextMock,
GroupCommandTriggerHandler unused = new GroupCommandTriggerHandler(moduleMock, "ruleId", contextMock,
itemRegistryMock);
stopInterceptedLogger(GroupCommandTriggerHandler.class);

View File

@ -45,7 +45,7 @@ class GroupStateTriggerHandlerTest extends JavaTest {
when(moduleMock.getId()).thenReturn("triggerId");
setupInterceptedLogger(GroupStateTriggerHandler.class, LogLevel.WARN);
GroupStateTriggerHandler handler = new GroupStateTriggerHandler(moduleMock, "ruleId", contextMock,
GroupStateTriggerHandler unused = new GroupStateTriggerHandler(moduleMock, "ruleId", contextMock,
itemRegistryMock);
stopInterceptedLogger(GroupStateTriggerHandler.class);
@ -61,7 +61,7 @@ class GroupStateTriggerHandlerTest extends JavaTest {
when(moduleMock.getId()).thenReturn("triggerId");
setupInterceptedLogger(GroupStateTriggerHandler.class, LogLevel.WARN);
GroupStateTriggerHandler handler = new GroupStateTriggerHandler(moduleMock, "ruleId", contextMock,
GroupStateTriggerHandler unused = new GroupStateTriggerHandler(moduleMock, "ruleId", contextMock,
itemRegistryMock);
stopInterceptedLogger(GroupStateTriggerHandler.class);

View File

@ -397,7 +397,6 @@ public class SitemapResource
public void getSitemapEvents(@Context final SseEventSink sseEventSink, @Context final HttpServletResponse response,
@PathParam("subscriptionid") @Parameter(description = "subscription id") String subscriptionId,
@QueryParam("sitemap") @Parameter(description = "sitemap name") @Nullable String sitemapname) {
getSitemapEvents(sseEventSink, response, subscriptionId, sitemapname, null, true);
}

View File

@ -35,8 +35,9 @@ import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;

View File

@ -44,8 +44,6 @@ import com.google.gson.stream.JsonWriter;
*/
public class JSONResponse {
private final Logger logger = LoggerFactory.getLogger(JSONResponse.class);
private static final JSONResponse INSTANCE = new JSONResponse();
private final Gson gson = new GsonBuilder().setDateFormat(DateTimeType.DATE_PATTERN_WITH_TZ_AND_MS).create();

View File

@ -130,9 +130,6 @@ public class ModbusRegisterArray {
return false;
}
ModbusRegisterArray other = (ModbusRegisterArray) obj;
if (!Arrays.equals(bytes, other.bytes)) {
return false;
}
return true;
return Arrays.equals(bytes, other.bytes);
}
}

View File

@ -813,7 +813,7 @@ public class SmokeTest extends IntegrationTestSupport {
EndpointPoolConfiguration newConfig = new EndpointPoolConfiguration();
newConfig.setConnectMaxTries(5);
try (ModbusCommunicationInterface comms = modbusManager.newModbusCommunicationInterface(getEndpoint(),
try (ModbusCommunicationInterface unused = modbusManager.newModbusCommunicationInterface(getEndpoint(),
newConfig)) {
// Sets configuration for the endpoint implicitly
}
@ -822,7 +822,8 @@ public class SmokeTest extends IntegrationTestSupport {
assertThat(modbusManager.getEndpointPoolConfiguration(getEndpoint()), is(not(equalTo(defaultConfig))));
// Reset config
try (ModbusCommunicationInterface comms = modbusManager.newModbusCommunicationInterface(getEndpoint(), null)) {
try (ModbusCommunicationInterface ignored = modbusManager.newModbusCommunicationInterface(getEndpoint(),
null)) {
// Sets configuration for the endpoint implicitly
}
// Should match the default
@ -863,7 +864,7 @@ public class SmokeTest extends IntegrationTestSupport {
long openSocketsAfter = getNumberOfOpenClients(SOCKET_SPY);
assertThat(openSocketsAfter, is(equalTo(1L)));
});
try (ModbusCommunicationInterface comms2 = modbusManager.newModbusCommunicationInterface(endpoint,
try (ModbusCommunicationInterface ignored = modbusManager.newModbusCommunicationInterface(endpoint,
config)) {
{
CountDownLatch latch = new CountDownLatch(1);

View File

@ -135,7 +135,7 @@ public class YamlModelRepositoryImplTest {
assertThat(firstTypeElements,
containsInAnyOrder(new FirstTypeDTO("First1", "Description1"), new FirstTypeDTO("First2", null)));
assertThat(secondTypeElements1, contains(new SecondTypeDTO("Second1", "Label1")));
assertThat(secondTypeElements1, contains(new SecondTypeDTO("Second1", "Label1")));
assertThat(secondTypeElements2, contains(new SecondTypeDTO("Second1", "Label1")));
}
@Test

View File

@ -1813,7 +1813,6 @@ public class PersistenceExtensions {
DecimalType valueStop = null;
if (itemStop != null) {
valueStop = getPersistedValue(itemStop, unit);
}
if (begin == null && end != null && end.isAfter(ZonedDateTime.now())) {
@ -2054,7 +2053,6 @@ public class PersistenceExtensions {
DecimalType valueStop = null;
if (itemStop != null) {
valueStop = getPersistedValue(itemStop, unit);
}
if (begin == null && end != null && end.isAfter(ZonedDateTime.now())) {

View File

@ -224,13 +224,6 @@ public class ItemChannelLinkRegistry extends AbstractLinkRegistry<ItemChannelLin
// it is not needed to send an event, because links can not be updated
}
private boolean isEditable(String linkId) {
if (getManagedProvider().isPresent()) {
return getManagedProvider().get().get(linkId) != null;
}
return false;
}
public enum ItemChannelLinkProblem {
THING_CHANNEL_MISSING,
ITEM_MISSING,

View File

@ -95,7 +95,7 @@ public class CurrencyConverter extends AbstractConverter {
*/
static {
// call to ensure map is initialized
Map<Class<? extends AbstractConverter>, Integer> normalFormOrder = (Map<Class<? extends AbstractConverter>, Integer>) Calculus
Map<Class<? extends AbstractConverter>, Integer> unused = (Map<Class<? extends AbstractConverter>, Integer>) Calculus
.getNormalFormOrder();
try {
Field field = Calculus.class.getDeclaredField("normalFormOrder");

View File

@ -410,7 +410,6 @@ public class QuantityType<T extends Quantity<T>> extends Number
// Wile time is representing a duration (Scale.RELATIVE), formatting patterns mimic String format patterns for
// DateTime to not break backward compatibility and to avoid introducing specific duration formatting.
if (quantity.getUnit().isCompatible(Units.SECOND) && !unitPlaceholder) {
QuantityType<T> millis = toUnit(MetricPrefix.MILLI(Units.SECOND));
if (millis != null) {
Duration duration = Duration.ofMillis(millis.longValue());

View File

@ -190,7 +190,6 @@ public class ThreadPoolManagerTest {
try {
block.await();
} catch (InterruptedException e) {
}
check.countDown();
}, 1, TimeUnit.MILLISECONDS);