Skip to content

Commit 48f9606

Browse files
Update to PMD 7.12.0 for static analysis (#375)
Addresses CVE-2025-23215. Signed-off-by: Muthu <muthu.sundaravadivel@in.ibm.com> Co-authored-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
1 parent 8fb3168 commit 48f9606

File tree

7 files changed

+7
-8
lines changed

7 files changed

+7
-8
lines changed

fabric-chaincode-shim/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plugins {
1212
}
1313

1414
pmd {
15-
toolVersion = '7.7.0'
15+
toolVersion = '7.12.0'
1616
ruleSetFiles = files('../pmd-ruleset.xml')
1717
ruleSets = [] // explicitly set to empty to avoid using the default configuration
1818
ignoreFailures = false

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/execution/ExecutionService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*
1616
* <p>Service that executes {@link InvocationRequest} (wrapped Init/Invoke + extra data) using routing information
1717
*/
18+
@FunctionalInterface
1819
public interface ExecutionService {
1920

2021
/**

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/execution/impl/ContractInvocationRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.hyperledger.fabric.shim.ChaincodeStub;
1616

1717
public final class ContractInvocationRequest implements InvocationRequest {
18-
@SuppressWarnings("PMD.ProperLogger") // PMD 7.7.0 gives a false positive here
18+
@SuppressWarnings("PMD.ProperLogger") // PMD 7.12.0 gives a false positive here
1919
private static final Log LOGGER = LogFactory.getLog(ContractInvocationRequest.class);
2020

2121
private static final Pattern NS_REGEX = Pattern.compile(":");

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/routing/impl/SerializerRegistryImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
public class SerializerRegistryImpl {
2525
private static final Logger LOGGER = Logger.getLogger(SerializerRegistryImpl.class);
2626

27-
private final Class<Serializer> annotationClass = Serializer.class;
27+
private static final Class<Serializer> ANNOTATION_CLASS = Serializer.class;
2828

2929
// Could index these by name and or type.
3030
private final Map<String, SerializerInterface> contents = new HashMap<>();
@@ -68,7 +68,7 @@ public void findAndSetContents() throws InstantiationException, IllegalAccessExc
6868

6969
try (ScanResult scanResult = classGraph.scan()) {
7070
for (final ClassInfo classInfo :
71-
scanResult.getClassesWithAnnotation(this.annotationClass.getCanonicalName())) {
71+
scanResult.getClassesWithAnnotation(this.ANNOTATION_CLASS.getCanonicalName())) {
7272
LOGGER.debug(() -> "Found class with contract annotation: " + classInfo.getName());
7373
final Class<SerializerInterface> cls = (Class<SerializerInterface>) classInfo.loadClass();
7474
LOGGER.debug("Loaded class");

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/ledger/Collection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.hyperledger.fabric.ledger;
77

88
/** Place holder. */
9+
@SuppressWarnings("PMD.ImplicitFunctionalInterface")
910
public interface Collection {
1011

1112
/** Constant that can be used to refer to the 'Worldstate' collection explicitly. */

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ext/sbe/impl/StateBasedEndorsementImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/** Implements {@link StateBasedEndorsement}. */
2525
public final class StateBasedEndorsementImpl implements StateBasedEndorsement {
26-
@SuppressWarnings("PMD.ProperLogger") // PMD 7.7.0 reports a false positive
26+
@SuppressWarnings("PMD.ProperLogger") // PMD 7.12.0 reports a false positive
2727
private static final Log LOGGER = LogFactory.getLog(StateBasedEndorsementImpl.class);
2828

2929
private final Map<String, MSPRoleType> orgs = new HashMap<>();

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/InvocationTaskManager.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,6 @@ private void processChaincodeMessage(final ChaincodeMessage chaincodeMessage) {
183183
case READY:
184184
handleMsg(chaincodeMessage, msgType);
185185
break;
186-
default:
187-
LOGGER.warning(() -> String.format(CANNOT_HANDLE_FORMAT, chaincodeMessage.getTxid(), msgType));
188-
break;
189186
}
190187
}
191188

0 commit comments

Comments
 (0)