Enable PMD rule UnnecessaryBoxing and fix violations

This commit is contained in:
Manuel Fuhr 2024-04-03 14:50:05 +02:00
parent dd896347a2
commit c73a8cebb8
6 changed files with 30 additions and 34 deletions

View file

@ -15,7 +15,7 @@ public class IpAccessMonitor {
synchronized (sync) {
Long lastTime = ipAccess.get(ip);
ipAccess.put(ip, t);
return lastTime == null || t - lastTime.longValue() > MAX_IDLE;
return lastTime == null || t - lastTime > MAX_IDLE;
}
}
@ -33,7 +33,7 @@ public class IpAccessMonitor {
private static void cleanup(long t) {
Map<String, Long> newMap = new HashMap<>(ipAccess.size());
for (Map.Entry<String, Long> e : ipAccess.entrySet()) {
if (t - e.getValue().longValue() <= MAX_IDLE) {
if (t - e.getValue() <= MAX_IDLE) {
newMap.put(e.getKey(), e.getValue());
}
}