Fix spotbugs warnings.

master
Bertrik Sikken 2021-08-28 21:22:37 +02:00
rodzic b405eff479
commit 85a147c959
4 zmienionych plików z 10 dodań i 11 usunięć

Wyświetl plik

@ -19,7 +19,7 @@ public final class ExpiringCache {
* @param expiryTime the expiry time
*/
public ExpiringCache(Duration expiryTime) {
this.expiryTime = expiryTime;
this.expiryTime = Duration.from(expiryTime);
}
/**
@ -42,11 +42,7 @@ public final class ExpiringCache {
*/
private void cleanUp(Instant now) {
Instant limit = now.minus(expiryTime);
map.forEach((k,v) -> {
if (v.isBefore(limit)) {
map.remove(k, v);
}
});
map.values().removeIf(v -> v.isBefore(limit));
}
}

Wyświetl plik

@ -1,6 +1,7 @@
package nl.sikken.bertrik.hab;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
@ -34,7 +35,7 @@ public final class Sentence {
public Sentence(String callSign, int id, Instant time) {
this.callSign = callSign;
this.id = id;
this.time = time;
this.time = Instant.from(time);
}
/**

Wyświetl plik

@ -2,6 +2,7 @@ package nl.sikken.bertrik.hab.habitat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
@ -29,7 +30,7 @@ public final class UuidsList {
}
public List<String> getUuids() {
return uuids;
return Collections.unmodifiableList(uuids);
}
}

Wyświetl plik

@ -2,6 +2,7 @@ package nl.sikken.bertrik.hab.ttn;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -26,7 +27,7 @@ public final class TtnUplinkMessage {
public TtnUplinkMessage(Instant time, String appId, String deviceId, int counter, int port, byte[] payloadRaw,
boolean isRetry) {
this.time = time;
this.time = Instant.from(time);
this.appId = appId;
this.deviceId = deviceId;
this.counter = counter;
@ -40,7 +41,7 @@ public final class TtnUplinkMessage {
}
public Instant getTime() {
return time;
return Instant.from(time);
}
public String getAppId() {
@ -76,7 +77,7 @@ public final class TtnUplinkMessage {
}
public List<GatewayInfo> getGateways() {
return gateways;
return Collections.unmodifiableList(gateways);
}
public static final class GatewayInfo {