From c7f8bb865a2fd413f4472332e48be32e327c3f94 Mon Sep 17 00:00:00 2001 From: Carlos Macasaet Date: Fri, 29 May 2026 21:44:54 -0500 Subject: [PATCH] Update warning suppressions Update suppressions to match newer PMD rules. --- .../aws/secretsmanager/rotation/AbstractFernetKeyRotator.java | 3 +-- fernet-java8/src/main/java/com/macasaet/fernet/Key.java | 2 +- .../main/java/com/macasaet/fernet/StringObjectValidator.java | 1 + fernet-java8/src/main/java/com/macasaet/fernet/Token.java | 3 +-- fernet-java8/src/main/java/com/macasaet/fernet/Validator.java | 2 +- src/main/config/pmd-ruleset.xml | 1 + 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fernet-aws-secrets-manager-rotator/src/main/java/com/macasaet/fernet/aws/secretsmanager/rotation/AbstractFernetKeyRotator.java b/fernet-aws-secrets-manager-rotator/src/main/java/com/macasaet/fernet/aws/secretsmanager/rotation/AbstractFernetKeyRotator.java index eb0dd021..89c80467 100644 --- a/fernet-aws-secrets-manager-rotator/src/main/java/com/macasaet/fernet/aws/secretsmanager/rotation/AbstractFernetKeyRotator.java +++ b/fernet-aws-secrets-manager-rotator/src/main/java/com/macasaet/fernet/aws/secretsmanager/rotation/AbstractFernetKeyRotator.java @@ -49,7 +49,7 @@ *

Copyright © 2018 Carlos Macasaet.

* @author Carlos Macasaet */ -@SuppressWarnings({"PMD.BeanMembersShouldSerialize", "PMD.TooManyMethods"}) +@SuppressWarnings("PMD.TooManyMethods") abstract class AbstractFernetKeyRotator implements RequestStreamHandler { private final Logger logger = LogManager.getLogger(getClass()); @@ -177,7 +177,6 @@ protected void conditionallyCreateSecret(final String secretId, final String cli */ protected abstract void testSecret(String secretId, String clientRequestToken); - @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map> versions) { final Entry currentEntry = versions.entrySet().stream().filter(entry -> { diff --git a/fernet-java8/src/main/java/com/macasaet/fernet/Key.java b/fernet-java8/src/main/java/com/macasaet/fernet/Key.java index 44170384..06ef9d07 100644 --- a/fernet-java8/src/main/java/com/macasaet/fernet/Key.java +++ b/fernet-java8/src/main/java/com/macasaet/fernet/Key.java @@ -57,7 +57,7 @@ * * @author Carlos Macasaet */ -@SuppressWarnings({"PMD.AvoidDuplicateLiterals", "PMD.TooManyMethods", "PMD.GodClass"}) +@SuppressWarnings("PMD.GodClass") public class Key { private final byte[] signingKey; diff --git a/fernet-java8/src/main/java/com/macasaet/fernet/StringObjectValidator.java b/fernet-java8/src/main/java/com/macasaet/fernet/StringObjectValidator.java index aac37c89..055ce85b 100644 --- a/fernet-java8/src/main/java/com/macasaet/fernet/StringObjectValidator.java +++ b/fernet-java8/src/main/java/com/macasaet/fernet/StringObjectValidator.java @@ -33,6 +33,7 @@ * The type of the payload. The Fernet token encodes the payload in binary. The type T should be a domain * object or data transfer object representation of that data. */ +@SuppressWarnings("PMD.ImplicitFunctionalInterface") public interface StringObjectValidator extends Validator { default Charset getCharset() { diff --git a/fernet-java8/src/main/java/com/macasaet/fernet/Token.java b/fernet-java8/src/main/java/com/macasaet/fernet/Token.java index 39d9fe70..9cc6e5ac 100644 --- a/fernet-java8/src/main/java/com/macasaet/fernet/Token.java +++ b/fernet-java8/src/main/java/com/macasaet/fernet/Token.java @@ -47,7 +47,7 @@ * * @author Carlos Macasaet */ -@SuppressWarnings({"PMD.TooManyMethods", "PMD.AvoidDuplicateLiterals", "PMD.GodClass"}) +@SuppressWarnings({"PMD.TooManyMethods", "PMD.GodClass"}) /* * TooManyMethods can be avoided by making the following API-breaking changes: * * remove the static `generate` methods and introduce a `TokenFactory` or `TokenBuilder` @@ -117,7 +117,6 @@ protected Token(final byte version, final Instant timestamp, final IvParameterSp * @throws IllegalTokenException if the input string cannot be a valid * token irrespective of key or timestamp. */ - @SuppressWarnings({"PMD.PrematureDeclaration", "PMD.DataflowAnomalyAnalysis"}) public static Token fromBytes(final byte[] bytes) { if (bytes.length < minimumTokenBytes) { throw new IllegalTokenException("Not enough bits to generate a Token"); diff --git a/fernet-java8/src/main/java/com/macasaet/fernet/Validator.java b/fernet-java8/src/main/java/com/macasaet/fernet/Validator.java index 5db5e93a..5c6c10d4 100644 --- a/fernet-java8/src/main/java/com/macasaet/fernet/Validator.java +++ b/fernet-java8/src/main/java/com/macasaet/fernet/Validator.java @@ -39,6 +39,7 @@ * @see StringValidator * @author Carlos Macasaet */ +@SuppressWarnings("PMD.ImplicitFunctionalInterface") public interface Validator { /** @@ -98,7 +99,6 @@ default Predicate getObjectValidator() { * @return the deserialised contents of the token * @throws TokenValidationException if the token is invalid. */ - @SuppressWarnings("PMD.DataflowAnomalyAnalysis") default T validateAndDecrypt(final Key key, final Token token) { final Instant now = Instant.now(getClock()); final byte[] plainText = token.validateAndDecrypt(key, now.minus(getTimeToLive()), now.plus(getMaxClockSkew())); diff --git a/src/main/config/pmd-ruleset.xml b/src/main/config/pmd-ruleset.xml index cf527d0f..d8e31960 100644 --- a/src/main/config/pmd-ruleset.xml +++ b/src/main/config/pmd-ruleset.xml @@ -59,6 +59,7 @@ under the License. +