Fix several compiler warnings (#3260)
Fixes a deprecation, unused imports and some raw type warning. Signed-off-by: Wouter Born <github@maindrain.net>pull/3271/head
parent
4a49cb419c
commit
80770161ac
|
@ -13,7 +13,7 @@
|
|||
package org.openhab.core.automation.internal.module.handler;
|
||||
|
||||
import static java.util.Map.entry;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import java.time.ZoneId;
|
||||
|
|
|
@ -143,7 +143,7 @@ public class JwtHelper {
|
|||
JwtConsumer jwtConsumer = new JwtConsumerBuilder().setRequireExpirationTime().setAllowedClockSkewInSeconds(30)
|
||||
.setRequireSubject().setExpectedIssuer(ISSUER_NAME).setExpectedAudience(AUDIENCE)
|
||||
.setVerificationKey(jwtWebKey.getKey())
|
||||
.setJwsAlgorithmConstraints(ConstraintType.WHITELIST, AlgorithmIdentifiers.RSA_USING_SHA256).build();
|
||||
.setJwsAlgorithmConstraints(ConstraintType.PERMIT, AlgorithmIdentifiers.RSA_USING_SHA256).build();
|
||||
|
||||
try {
|
||||
JwtClaims jwtClaims = jwtConsumer.processToClaims(jwt);
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
@ -44,6 +43,7 @@ import org.openhab.core.model.core.ModelRepositoryChangeListener;
|
|||
import org.openhab.core.model.rule.jvmmodel.RulesRefresher;
|
||||
import org.openhab.core.model.rule.rules.ChangedEventTrigger;
|
||||
import org.openhab.core.model.rule.rules.CommandEventTrigger;
|
||||
import org.openhab.core.model.rule.rules.DateTimeTrigger;
|
||||
import org.openhab.core.model.rule.rules.EventEmittedTrigger;
|
||||
import org.openhab.core.model.rule.rules.EventTrigger;
|
||||
import org.openhab.core.model.rule.rules.GroupMemberChangedEventTrigger;
|
||||
|
@ -56,7 +56,6 @@ import org.openhab.core.model.rule.rules.SystemStartlevelTrigger;
|
|||
import org.openhab.core.model.rule.rules.ThingStateChangedEventTrigger;
|
||||
import org.openhab.core.model.rule.rules.ThingStateUpdateEventTrigger;
|
||||
import org.openhab.core.model.rule.rules.TimerTrigger;
|
||||
import org.openhab.core.model.rule.rules.DateTimeTrigger;
|
||||
import org.openhab.core.model.rule.rules.UpdateEventTrigger;
|
||||
import org.openhab.core.model.script.runtime.DSLScriptContextProvider;
|
||||
import org.openhab.core.model.script.script.Script;
|
||||
|
@ -321,9 +320,8 @@ public class DSLRuleProvider
|
|||
}
|
||||
String firstLine = s.lines().findFirst().orElse("");
|
||||
String indentation = firstLine.substring(0, firstLine.length() - firstLine.stripLeading().length());
|
||||
return s.lines().map(line -> {
|
||||
return line.startsWith(indentation) ? line.substring(indentation.length()) : line;
|
||||
}).collect(Collectors.joining("\n"));
|
||||
return s.lines().map(line -> (line.startsWith(indentation) ? line.substring(indentation.length()) : line))
|
||||
.collect(Collectors.joining("\n"));
|
||||
}
|
||||
|
||||
private @Nullable Trigger mapTrigger(EventTrigger t) {
|
||||
|
@ -410,9 +408,9 @@ public class DSLRuleProvider
|
|||
cfg.put("cronExpression", tt.getCron());
|
||||
} else {
|
||||
id = tt.getTime();
|
||||
if (id.equals("noon")) {
|
||||
if ("noon".equals(id)) {
|
||||
cfg.put("cronExpression", "0 0 12 * * ?");
|
||||
} else if (id.equals("midnight")) {
|
||||
} else if ("midnight".equals(id)) {
|
||||
cfg.put("cronExpression", "0 0 0 * * ?");
|
||||
} else {
|
||||
logger.warn("Unrecognized time expression '{}' in rule trigger", tt.getTime());
|
||||
|
|
|
@ -1077,7 +1077,7 @@ public class InboxOSGiTest extends JavaOSGiTest {
|
|||
// reduce time between retries to ensure the test does not time out
|
||||
inbox.setDiscoveryResultAddRetryInterval(1);
|
||||
|
||||
CompletableFuture future = inbox.add(discoveryResult);
|
||||
CompletableFuture<Boolean> future = inbox.add(discoveryResult);
|
||||
|
||||
waitForAssert(() -> future.isDone(), 30, 5);
|
||||
|
||||
|
@ -1093,7 +1093,7 @@ public class InboxOSGiTest extends JavaOSGiTest {
|
|||
// reduce time between retries to ensure the test does not time out
|
||||
inbox.setDiscoveryResultAddRetryInterval(1);
|
||||
|
||||
CompletableFuture future = inbox.add(discoveryResult);
|
||||
CompletableFuture<Boolean> future = inbox.add(discoveryResult);
|
||||
|
||||
dummyThingTypeProvider.add(thingTypeUID, ThingTypeBuilder.instance(thingTypeUID, "label").build());
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ public class ItemResourceOSGiTest extends JavaOSGiTest {
|
|||
@Test
|
||||
public void addMultipleItems() throws IOException {
|
||||
List<GroupItemDTO> itemList = new ArrayList<>();
|
||||
GroupItemDTO[] items = new GroupItemDTO[] {};
|
||||
GroupItemDTO[] items = {};
|
||||
|
||||
GroupItemDTO item1DTO = new GroupItemDTO();
|
||||
item1DTO.name = "item1";
|
||||
|
@ -353,7 +353,7 @@ public class ItemResourceOSGiTest extends JavaOSGiTest {
|
|||
|
||||
@ParameterizedTest
|
||||
@MethodSource("findTagTestSource")
|
||||
public void findTagTest(String itemName, String semanticClassName, @Nullable Matcher<Iterable> matcher)
|
||||
public void findTagTest(String itemName, String semanticClassName, @Nullable Matcher<Iterable<String>> matcher)
|
||||
throws IOException {
|
||||
// setup test: item1 has the location, item2 the equipment, item3 is the point
|
||||
item1.addTag("Office");
|
||||
|
|
Loading…
Reference in New Issue