From a26c1b70e4bec6f9639537c63919cdeb175a1468 Mon Sep 17 00:00:00 2001 From: tommy stendahl Date: Tue, 26 Sep 2023 11:58:53 +0200 Subject: [PATCH] Step maven-pmd-plugin version to support java17 --- .../ecaudit/auth/ConnectionResource.java | 2 +- .../ecaudit/auth/WhitelistOptionParser.java | 2 +- .../entry/suppressor/SuppressBlobs.java | 2 +- .../ecaudit/filter/role/RoleAuditFilter.java | 5 ++++- .../ecaudit/logger/FileQueueBootstrapper.java | 5 ++++- .../logger/SizeRotatingStoreFileListener.java | 20 +++++++++++++++---- .../ecaudit/logger/Slf4jAuditLogger.java | 5 ++++- pom.xml | 2 +- 8 files changed, 32 insertions(+), 11 deletions(-) diff --git a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/auth/ConnectionResource.java b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/auth/ConnectionResource.java index 0f147eec..1f08de28 100644 --- a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/auth/ConnectionResource.java +++ b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/auth/ConnectionResource.java @@ -77,7 +77,7 @@ public static ConnectionResource fromName(String name) { String[] parts = StringUtils.split(name, '/'); - if (!parts[0].equals(ROOT_NAME) || parts.length > 1) + if (!ROOT_NAME.equals(parts[0]) || parts.length > 1) { throw new IllegalArgumentException(String.format("%s is not a valid connection resource name", name)); } diff --git a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/auth/WhitelistOptionParser.java b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/auth/WhitelistOptionParser.java index 6f13c750..b3baac89 100644 --- a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/auth/WhitelistOptionParser.java +++ b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/auth/WhitelistOptionParser.java @@ -45,7 +45,7 @@ else if (normalizedInput.startsWith(REVOKE_PREFIX)) { return WhitelistOperation.REVOKE; } - else if (normalizedInput.equals(DROP_LEGACY_KEY_PATTERN)) + else if (DROP_LEGACY_KEY_PATTERN.equals(normalizedInput)) { return WhitelistOperation.DROP_LEGACY; } diff --git a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/entry/suppressor/SuppressBlobs.java b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/entry/suppressor/SuppressBlobs.java index e9da9bd3..337e504b 100644 --- a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/entry/suppressor/SuppressBlobs.java +++ b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/entry/suppressor/SuppressBlobs.java @@ -41,7 +41,7 @@ private boolean containsBlob(AbstractType type) { if (type.asCQL3Type() instanceof CQL3Type.Native) { - return type.asCQL3Type() == CQL3Type.Native.BLOB; + return type.asCQL3Type().equals(CQL3Type.Native.BLOB); } if (type instanceof CollectionType) { diff --git a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/filter/role/RoleAuditFilter.java b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/filter/role/RoleAuditFilter.java index 90b32876..3903229d 100644 --- a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/filter/role/RoleAuditFilter.java +++ b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/filter/role/RoleAuditFilter.java @@ -99,7 +99,10 @@ public boolean isWhitelisted(AuditEntry logEntry) } catch (UnavailableException e) { - LOG.debug("Audit entry for {} not whitelisted as filter backend is unavailable", logEntry.getUser(), e); + if(LOG.isDebugEnabled()) + { + LOG.debug("Audit entry for {} not whitelisted as filter backend is unavailable", logEntry.getUser(), e); + } return false; } } diff --git a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/FileQueueBootstrapper.java b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/FileQueueBootstrapper.java index d200e53c..48a3d723 100644 --- a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/FileQueueBootstrapper.java +++ b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/FileQueueBootstrapper.java @@ -66,7 +66,10 @@ void discoverFiles() for (File discoveredFile : discoveredFiles) { - LOG.debug("Discovered {}", discoveredFile.getPath()); + if(LOG.isDebugEnabled()) + { + LOG.debug("Discovered {}", discoveredFile.getPath()); + } } } diff --git a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/SizeRotatingStoreFileListener.java b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/SizeRotatingStoreFileListener.java index 7a9d59b5..e5539a9f 100644 --- a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/SizeRotatingStoreFileListener.java +++ b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/SizeRotatingStoreFileListener.java @@ -48,7 +48,10 @@ private void reset() @Override public synchronized void onAcquired(int cycle, File file) { - LOG.debug("Chronicle acquired [{}] {} at {} bytes", cycle, file.getPath(), file.length()); + if(LOG.isDebugEnabled()) + { + LOG.debug("Chronicle acquired [{}] {} at {} bytes", cycle, file.getPath(), file.length()); + } if (bootstrapper.isBootstrapping()) { @@ -62,7 +65,10 @@ public synchronized void onAcquired(int cycle, File file) @Override public void onReleased(int cycle, File file) { - LOG.debug("Chronicle released [{}] {} at {} bytes", cycle, file.getPath(), file.length()); + if(LOG.isDebugEnabled()) + { + LOG.debug("Chronicle released [{}] {} at {} bytes", cycle, file.getPath(), file.length()); + } releasedFileQueue.offer(file); maybeRotate(); @@ -89,10 +95,16 @@ private boolean tryDeleteOldestFile() return false; } - LOG.debug("Deleting Chronicle file {} at {} bytes", toDelete.getPath(), toDelete.getPath().length()); + if(LOG.isDebugEnabled()) + { + LOG.debug("Deleting Chronicle file {} at {} bytes", toDelete.getPath(), toDelete.getPath().length()); + } if (!toDelete.delete()) { - LOG.error("Failed to delete Chronicle file {}", toDelete.getPath()); + if(LOG.isErrorEnabled()) + { + LOG.error("Failed to delete Chronicle file {}", toDelete.getPath()); + } return false; } diff --git a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/Slf4jAuditLogger.java b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/Slf4jAuditLogger.java index 49307ff1..b8937b2e 100644 --- a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/Slf4jAuditLogger.java +++ b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/logger/Slf4jAuditLogger.java @@ -126,6 +126,9 @@ private static Function getFormattedTimestamp(DateTimeFormat @Override public void log(AuditEntry logEntry) { - auditLogger.info(formatter.getLogTemplate(), formatter.getArgumentsForEntry(logEntry)); + if(auditLogger.isInfoEnabled()) + { + auditLogger.info(formatter.getLogTemplate(), formatter.getArgumentsForEntry(logEntry)); + } } } diff --git a/pom.xml b/pom.xml index 87c3ce25..45335be4 100644 --- a/pom.xml +++ b/pom.xml @@ -85,7 +85,7 @@ 1.6 0.8.6 1.6.2 - 3.14.0 + 3.15.0