Skip to content

Commit

Permalink
Fix PMD violations
Browse files Browse the repository at this point in the history
  • Loading branch information
reta committed Feb 28, 2025
1 parent eb8b1c5 commit 088b463
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void write(String str, int off, int len) throws IOException {
public void close() throws IOException {
LoggingMessage buffer = setupBuffer(message);
if (count >= lim) {
buffer.getMessage().append("(message truncated to " + lim + " bytes)\n");
buffer.getMessage().append("(message truncated to ").append(lim).append(" bytes)\n");
}
StringWriter w2 = out2;
if (w2 == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.cxf.jaxrs.ext.search.fiql;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -79,7 +80,7 @@ public class FiqlParser<T> extends AbstractSearchConditionParser<T> {
OPERATORS_MAP.put(EQ, ConditionType.EQUALS);
OPERATORS_MAP.put(NEQ, ConditionType.NOT_EQUALS);

CONDITION_MAP = new HashMap<>();
CONDITION_MAP = new EnumMap<>(ConditionType.class);
CONDITION_MAP.put(ConditionType.GREATER_THAN, GT);
CONDITION_MAP.put(ConditionType.GREATER_OR_EQUALS, GE);
CONDITION_MAP.put(ConditionType.LESS_THAN, LT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -79,7 +79,7 @@
public final class JwkUtils {
private static final Map<KeyType, List<String>> JWK_REQUIRED_FIELDS_MAP;
static {
JWK_REQUIRED_FIELDS_MAP = new HashMap<>();
JWK_REQUIRED_FIELDS_MAP = new EnumMap<>(KeyType.class);
JWK_REQUIRED_FIELDS_MAP.put(KeyType.RSA, Arrays.asList(
JsonWebKey.RSA_PUBLIC_EXP, JsonWebKey.KEY_TYPE, JsonWebKey.RSA_MODULUS));
JWK_REQUIRED_FIELDS_MAP.put(KeyType.EC, Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.security.interfaces.ECPrivateKey;
import java.security.interfaces.RSAKey;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
Expand Down Expand Up @@ -229,7 +229,7 @@ public static JwsSignatureVerifier getHmacSignatureVerifier(byte[] key, Signatur

public static Map<SignatureAlgorithm, List<JwsJsonSignatureEntry>> getJwsJsonSignatureMap(
List<JwsJsonSignatureEntry> signatures) {
Map<SignatureAlgorithm, List<JwsJsonSignatureEntry>> map = new HashMap<>();
Map<SignatureAlgorithm, List<JwsJsonSignatureEntry>> map = new EnumMap<>(SignatureAlgorithm.class);
for (JwsJsonSignatureEntry entry : signatures) {
SignatureAlgorithm sigAlgorithm = entry.getUnionHeader().getSignatureAlgorithm();
List<JwsJsonSignatureEntry> entries = map.get(sigAlgorithm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ protected boolean isConfidenatialClientSecretValid(Client client, String provide
if (clientSecretVerifier != null) {
return clientSecretVerifier.validateClientSecret(client, providedClientSecret);
}
return client.getClientSecret() != null
&& providedClientSecret != null && client.getClientSecret().equals(providedClientSecret);
return client.getClientSecret() != null && client.getClientSecret().equals(providedClientSecret);
}
protected boolean isValidPublicClient(Client client, String clientId) {
return canSupportPublicClients
Expand Down
6 changes: 3 additions & 3 deletions rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.apache.cxf.ws.rm;

import java.util.Collection;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -101,8 +101,8 @@ public class RMEndpoint {
private EndpointReferenceType replyTo;
private Source source;
private Destination destination;
private final Map<ProtocolVariation, WrappedService> services = new HashMap<>();
private final Map<ProtocolVariation, Endpoint> endpoints = new HashMap<>();
private final Map<ProtocolVariation, WrappedService> services = new EnumMap<>(ProtocolVariation.class);
private final Map<ProtocolVariation, Endpoint> endpoints = new EnumMap<>(ProtocolVariation.class);
private Object tokenStore;
private Proxy proxy;
private Servant servant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public void testSaml2CombinedClaimsMultipleClaimsHandlers() throws Exception {
assertTrue(tokenString.contains(providerResponse.getTokenId()));
assertTrue(tokenString.contains("AttributeStatement"));

String requiredClaim = CustomClaimsHandler.ROLE_CLAIM.toString();
String requiredClaim = CustomClaimsHandler.ROLE_CLAIM;
assertTrue(tokenString.contains(requiredClaim));
assertTrue(tokenString.contains("DUMMY"));
assertTrue(tokenString.contains("CustomRole"));
Expand Down Expand Up @@ -447,7 +447,7 @@ public void testSaml2SeparateClaimsMultipleClaimsHandlers() throws Exception {
assertTrue(tokenString.contains(providerResponse.getTokenId()));
assertTrue(tokenString.contains("AttributeStatement"));

String requiredClaim = CustomClaimsHandler.ROLE_CLAIM.toString();
String requiredClaim = CustomClaimsHandler.ROLE_CLAIM;
assertTrue(tokenString.contains(requiredClaim));
assertTrue(tokenString.contains("DUMMY"));
assertTrue(tokenString.contains("CustomRole"));
Expand Down

0 comments on commit 088b463

Please sign in to comment.