diff --git a/build.gradle b/build.gradle index af1ae99d..7dbadf7e 100644 --- a/build.gradle +++ b/build.gradle @@ -6,9 +6,9 @@ plugins { id "com.github.ben-manes.versions" version "0.53.0" - id "com.diffplug.spotless" version "8.0.0" - id "com.gradleup.nmcp.aggregation" version "1.2.0" - id "com.gradleup.nmcp" version "1.2.0" apply false + id "com.diffplug.spotless" version "8.1.0" + id "com.gradleup.nmcp.aggregation" version "1.4.3" + id "com.gradleup.nmcp" version "1.4.3" apply false } version = '2.5.8' @@ -66,14 +66,14 @@ subprojects { } dependencies { - implementation 'commons-cli:commons-cli:1.10.0' + implementation 'commons-cli:commons-cli:1.11.0' implementation 'commons-logging:commons-logging:1.3.5' - testImplementation platform('org.junit:junit-bom:6.0.0') + testImplementation platform('org.junit:junit-bom:6.0.2') testImplementation 'org.junit.jupiter:junit-jupiter' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' testImplementation 'org.assertj:assertj-core:3.27.6' - testImplementation 'org.mockito:mockito-core:5.20.0' + testImplementation 'org.mockito:mockito-core:5.21.0' testImplementation 'uk.org.webcompere:system-stubs-jupiter:2.1.8' testImplementation 'org.hamcrest:hamcrest-library:3.0' diff --git a/examples/fabric-contract-example-as-service/build.gradle b/examples/fabric-contract-example-as-service/build.gradle index 69e14e21..8633c287 100644 --- a/examples/fabric-contract-example-as-service/build.gradle +++ b/examples/fabric-contract-example-as-service/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.gradleup.shadow' version '9.2.2' + id 'com.gradleup.shadow' version '9.3.1' id 'java' } @@ -14,11 +14,11 @@ repositories { dependencies { implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.7' - implementation 'org.json:json:20250517' - testImplementation platform('org.junit:junit-bom:6.0.1') + implementation 'org.json:json:20251224' + testImplementation platform('org.junit:junit-bom:6.0.2') testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation 'org.assertj:assertj-core:3.27.6' - testImplementation 'org.mockito:mockito-core:5.20.0' + testImplementation 'org.mockito:mockito-core:5.21.0' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' } diff --git a/examples/fabric-contract-example-gradle-kotlin/build.gradle.kts b/examples/fabric-contract-example-gradle-kotlin/build.gradle.kts index ab6300f7..24bbc177 100644 --- a/examples/fabric-contract-example-gradle-kotlin/build.gradle.kts +++ b/examples/fabric-contract-example-gradle-kotlin/build.gradle.kts @@ -5,7 +5,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { - id("com.gradleup.shadow") version "9.2.2" + id("com.gradleup.shadow") version "9.3.1" id("org.jetbrains.kotlin.jvm") version "2.2.21" } diff --git a/examples/fabric-contract-example-gradle/build.gradle b/examples/fabric-contract-example-gradle/build.gradle index 3eeabd76..39ff9593 100644 --- a/examples/fabric-contract-example-gradle/build.gradle +++ b/examples/fabric-contract-example-gradle/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.gradleup.shadow' version '9.2.2' + id 'com.gradleup.shadow' version '9.3.1' id 'java' } @@ -14,11 +14,11 @@ repositories { dependencies { implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.7' - implementation 'org.json:json:20250517' - testImplementation platform('org.junit:junit-bom:6.0.1') + implementation 'org.json:json:20251224' + testImplementation platform('org.junit:junit-bom:6.0.2') testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation 'org.assertj:assertj-core:3.27.6' - testImplementation 'org.mockito:mockito-core:5.20.0' + testImplementation 'org.mockito:mockito-core:5.21.0' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' } diff --git a/examples/fabric-contract-example-maven/pom.xml b/examples/fabric-contract-example-maven/pom.xml index 4f6ae2f0..05e857e0 100644 --- a/examples/fabric-contract-example-maven/pom.xml +++ b/examples/fabric-contract-example-maven/pom.xml @@ -89,14 +89,11 @@ junit-jupiter-engine test - - - org.mockito - mockito-core - 5.21.0 - - - + + org.mockito + mockito-core + 5.21.0 + org.json json diff --git a/examples/ledger-api/build.gradle b/examples/ledger-api/build.gradle index 07863155..6a9bde42 100644 --- a/examples/ledger-api/build.gradle +++ b/examples/ledger-api/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.gradleup.shadow' version '9.2.2' + id 'com.gradleup.shadow' version '9.3.1' id 'java' } @@ -14,11 +14,11 @@ repositories { dependencies { implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.7' - implementation 'org.json:json:20250517' - testImplementation platform('org.junit:junit-bom:6.0.0') + implementation 'org.json:json:20251224' + testImplementation platform('org.junit:junit-bom:6.0.2') testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation 'org.assertj:assertj-core:3.27.6' - testImplementation 'org.mockito:mockito-core:5.20.0' + testImplementation 'org.mockito:mockito-core:5.21.0' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' } diff --git a/fabric-chaincode-docker/Dockerfile b/fabric-chaincode-docker/Dockerfile index 75415c38..db4d4bd5 100644 --- a/fabric-chaincode-docker/Dockerfile +++ b/fabric-chaincode-docker/Dockerfile @@ -8,9 +8,9 @@ RUN curl -s "https://get.sdkman.io" | bash SHELL ["/bin/bash", "-c"] -RUN source /root/.sdkman/bin/sdkman-init.sh \ - && sdk install gradle 9.1.0 \ - && sdk install maven 3.9.11 +RUN . /root/.sdkman/bin/sdkman-init.sh \ + && sdk install gradle 9.3.0 \ + && sdk install maven 3.9.12 FROM ${JAVA_IMAGE} AS dependencies @@ -48,7 +48,7 @@ RUN gradle \ WORKDIR /root/chaincode-java # Run the Gradle and Maven commands to generate the wrapper variants # of each tool -#Gradle doesn't run without settings.gradle file, so create one +# Gradle doesn't run without settings.gradle file, so create one RUN touch settings.gradle \ && gradle wrapper \ && ./gradlew wrapper \ diff --git a/fabric-chaincode-docker/build.gradle b/fabric-chaincode-docker/build.gradle index 3669c2c1..db3a965b 100644 --- a/fabric-chaincode-docker/build.gradle +++ b/fabric-chaincode-docker/build.gradle @@ -5,7 +5,7 @@ */ plugins { - id 'com.bmuschko.docker-remote-api' version '9.4.0' + id 'com.bmuschko.docker-remote-api' version '10.0.0' } repositories { diff --git a/fabric-chaincode-integration-test/build.gradle b/fabric-chaincode-integration-test/build.gradle index 240c506e..dc4ceeac 100644 --- a/fabric-chaincode-integration-test/build.gradle +++ b/fabric-chaincode-integration-test/build.gradle @@ -1,7 +1,7 @@ dependencies { implementation project(':fabric-chaincode-docker') implementation project(':fabric-chaincode-shim') - implementation 'org.json:json:20250517' + implementation 'org.json:json:20251224' } diff --git a/fabric-chaincode-integration-test/src/contracts/bare-gradle/build.gradle b/fabric-chaincode-integration-test/src/contracts/bare-gradle/build.gradle index f176b86b..b1bd6a40 100644 --- a/fabric-chaincode-integration-test/src/contracts/bare-gradle/build.gradle +++ b/fabric-chaincode-integration-test/src/contracts/bare-gradle/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.gradleup.shadow' version '9.2.2' + id 'com.gradleup.shadow' version '9.3.1' id 'java' } diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/build.gradle b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/build.gradle index 053c3dd5..c31118ce 100644 --- a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/build.gradle +++ b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.gradleup.shadow' version '9.2.2' + id 'com.gradleup.shadow' version '9.3.1' id 'java' } diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/build.gradle b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/build.gradle index 4fb54344..bb0eafce 100644 --- a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/build.gradle +++ b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.gradleup.shadow' version '9.2.2' + id 'com.gradleup.shadow' version '9.3.1' id 'java' } diff --git a/fabric-chaincode-shim/build.gradle b/fabric-chaincode-shim/build.gradle index c864a48b..d5f39a14 100644 --- a/fabric-chaincode-shim/build.gradle +++ b/fabric-chaincode-shim/build.gradle @@ -13,7 +13,7 @@ plugins { } pmd { - toolVersion = '7.14.0' + toolVersion = '7.20.0' ruleSetFiles = files('../pmd-ruleset.xml') ruleSets = [] // explicitly set to empty to avoid using the default configuration ignoreFailures = false @@ -35,16 +35,16 @@ dependencies { because('CVE-2025-48924') } } - implementation platform('com.google.protobuf:protobuf-bom:4.33.0') - implementation platform('io.grpc:grpc-bom:1.77.0') - implementation platform('io.opentelemetry:opentelemetry-bom:1.56.0') + implementation platform('com.google.protobuf:protobuf-bom:4.33.4') + implementation platform('io.grpc:grpc-bom:1.78.0') + implementation platform('io.opentelemetry:opentelemetry-bom:1.58.0') implementation 'org.hyperledger.fabric:fabric-protos:0.3.7' - implementation 'org.bouncycastle:bcpkix-jdk18on:1.82' - implementation 'org.bouncycastle:bcprov-jdk18on:1.82' + implementation 'org.bouncycastle:bcpkix-jdk18on:1.83' + implementation 'org.bouncycastle:bcprov-jdk18on:1.83' implementation 'io.github.classgraph:classgraph:4.8.184' implementation 'com.github.erosb:everit-json-schema:1.14.6' - implementation 'org.json:json:20250517' + implementation 'org.json:json:20251224' implementation 'com.google.protobuf:protobuf-java-util' implementation 'io.grpc:grpc-netty-shaded' @@ -53,14 +53,14 @@ dependencies { testImplementation 'io.grpc:grpc-inprocess' implementation 'io.opentelemetry:opentelemetry-api' - implementation 'io.opentelemetry.proto:opentelemetry-proto:1.8.0-alpha' + implementation 'io.opentelemetry.proto:opentelemetry-proto:1.9.0-alpha' implementation 'io.opentelemetry:opentelemetry-sdk' implementation 'io.opentelemetry:opentelemetry-sdk-extension-autoconfigure' implementation 'io.opentelemetry:opentelemetry-sdk-trace' implementation 'io.opentelemetry:opentelemetry-exporter-otlp' implementation 'io.opentelemetry:opentelemetry-extension-trace-propagators' implementation 'io.opentelemetry.semconv:opentelemetry-semconv:1.37.0' - implementation 'io.opentelemetry.instrumentation:opentelemetry-grpc-1.6:2.21.0-alpha' + implementation 'io.opentelemetry.instrumentation:opentelemetry-grpc-1.6:2.24.0-alpha' } sourceSets { diff --git a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/ContractRouter.java b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/ContractRouter.java index d7b6f9e5..f8a4232c 100644 --- a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/ContractRouter.java +++ b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/ContractRouter.java @@ -102,7 +102,7 @@ void startRouting() { } } - @SuppressWarnings("PMD.AvoidCatchingThrowable") + @SuppressWarnings("PMD.AvoidCatchingGenericException") private Response processRequest(final ChaincodeStub stub) { LOGGER.info(() -> "Got invoke routing request"); try { diff --git a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/execution/JSONTransactionSerializer.java b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/execution/JSONTransactionSerializer.java index ac2e33b9..c6dd1b92 100644 --- a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/execution/JSONTransactionSerializer.java +++ b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/execution/JSONTransactionSerializer.java @@ -26,7 +26,12 @@ /** Used as the default serialisation for transmission from SDK to Contract. */ @Serializer() -@SuppressWarnings({"PMD.GodClass", "PMD.AvoidLiteralsInIfCondition", "PMD.AvoidDuplicateLiterals"}) +@SuppressWarnings({ + "PMD.GodClass", + "PMD.AvoidLiteralsInIfCondition", + "PMD.AvoidDuplicateLiterals", + "PMD.AvoidDeeplyNestedIfStmts" +}) public class JSONTransactionSerializer implements SerializerInterface { private static final Logger LOGGER = Logger.getLogger(JSONTransactionSerializer.class.getName()); private final TypeRegistry typeRegistry = TypeRegistry.getRegistry(); diff --git a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/ledger/impl/LedgerImpl.java b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/ledger/impl/LedgerImpl.java index 5d204ba2..347c516e 100644 --- a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/ledger/impl/LedgerImpl.java +++ b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/ledger/impl/LedgerImpl.java @@ -16,7 +16,6 @@ public final class LedgerImpl implements Ledger { * * @param ctx Context transactional context to use */ - @SuppressWarnings("PMD.UnusedFormalParameter") public LedgerImpl(final Context ctx) { // Empty stub } diff --git a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ChaincodeServerProperties.java b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ChaincodeServerProperties.java index 8197be59..865c9381 100644 --- a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ChaincodeServerProperties.java +++ b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ChaincodeServerProperties.java @@ -41,7 +41,7 @@ public ChaincodeServerProperties() { * @param permitKeepAliveWithoutCalls whether clients are allowed to send keep-alive HTTP/2 PINGs even if there are * no outstanding RPCs on the connection. */ - @SuppressWarnings({"PMD.UnusedFormalParameter", "PMD.NullAssignment"}) + @SuppressWarnings({"PMD.NullAssignment"}) public ChaincodeServerProperties( final int portChaincodeServer, final int maxInboundMetadataSize, diff --git a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ext/sbe/impl/StateBasedEndorsementImpl.java b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ext/sbe/impl/StateBasedEndorsementImpl.java index 56cae1a0..0cc6b08e 100644 --- a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ext/sbe/impl/StateBasedEndorsementImpl.java +++ b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ext/sbe/impl/StateBasedEndorsementImpl.java @@ -52,7 +52,7 @@ public byte[] policy() { @Override public void addOrgs(final RoleType role, final String... organizations) { MSPRoleType mspRole; - if (RoleType.RoleTypeMember.equals(role)) { + if (RoleType.RoleTypeMember == role) { mspRole = MSPRoleType.MEMBER; } else { mspRole = MSPRoleType.PEER; @@ -78,7 +78,7 @@ public List listOrgs() { private void setMSPIDsFromSP(final SignaturePolicyEnvelope spe) { spe.getIdentitiesList().stream() - .filter(identity -> Classification.ROLE.equals(identity.getPrincipalClassification())) + .filter(identity -> Classification.ROLE == identity.getPrincipalClassification()) .forEach(this::addOrg); } diff --git a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/ChaincodeInvocationTask.java b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/ChaincodeInvocationTask.java index 1f502b36..38865e2d 100644 --- a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/ChaincodeInvocationTask.java +++ b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/ChaincodeInvocationTask.java @@ -96,7 +96,7 @@ public ChaincodeMessage call() { // Call chaincode's invoke // Note in Fabric v2, there won't be any INIT - if (this.type.equals(Type.INIT)) { + if (this.type == Type.INIT) { result = chaincode.init(stub); } else { result = chaincode.invoke(stub); diff --git a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/traces/impl/OpenTelemetryTracesProvider.java b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/traces/impl/OpenTelemetryTracesProvider.java index 4801ebe3..a834af04 100644 --- a/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/traces/impl/OpenTelemetryTracesProvider.java +++ b/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/traces/impl/OpenTelemetryTracesProvider.java @@ -67,6 +67,6 @@ public Span createSpan(final ChaincodeStub stub) { @Override public ClientInterceptor createInterceptor() { - return grpcTracer.newClientInterceptor(); + return grpcTracer.createClientInterceptor(); } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 8bdaf60c..61285a65 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e111328..19a6bdeb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME