Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit adf7fce

Browse files
bestbeforetodaydenyeart
authored andcommitted
Explicit dependencies in integration test chaincode
Resolves breakages with latest releases of the chaincode shim, where more recent Gradle versions are more strict in requiring dependencies to be specified rather than picked up as transient dependencies. Also update commons-compress dependency to address security vulnerability. Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
1 parent 85b91b8 commit adf7fce

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
<dependency>
137137
<groupId>org.apache.commons</groupId>
138138
<artifactId>commons-compress</artifactId>
139-
<version>1.20</version>
139+
<version>1.21</version>
140140
</dependency>
141141
<dependency>
142142
<groupId>commons-io</groupId>

src/test/fixture/sdkintegration/javacc/2.1/sample1/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ repositories {
1717

1818
dependencies {
1919
implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.2.+'
20+
implementation 'commons-logging:commons-logging:1.2'
2021
}
2122

2223
shadowJar {

src/test/fixture/sdkintegration/javacc/2.1/sample1/src/main/java/org/hyperledger/fabric/example/SimpleChaincode.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
package org.hyperledger.fabric.example;
22

3+
import java.nio.charset.StandardCharsets;
34
import java.util.List;
45
import java.util.Map;
56

6-
import com.google.protobuf.ByteString;
77
import org.apache.commons.logging.Log;
88
import org.apache.commons.logging.LogFactory;
99
import org.hyperledger.fabric.shim.ChaincodeBase;
1010
import org.hyperledger.fabric.shim.ChaincodeStub;
1111
import org.hyperledger.fabric.shim.ResponseUtils;
1212

13-
import static java.nio.charset.StandardCharsets.UTF_8;
14-
1513
public class SimpleChaincode extends ChaincodeBase {
16-
1714
private static Log _logger = LogFactory.getLog(SimpleChaincode.class);
1815

1916
@Override
@@ -112,9 +109,6 @@ private Response move(ChaincodeStub stub, List<String> args) {
112109
}
113110
}
114111
return ResponseUtils.newSuccessResponse();
115-
// return newSuccessResponse("invoke finished successfully", ByteString.copyFrom(accountFromKey + ": " + accountFromValue + " " + accountToKey + ": " + accountToValue, UTF_8).
116-
//
117-
// toByteArray());
118112
}
119113

120114
// Deletes an entity from state
@@ -140,11 +134,10 @@ private Response query(ChaincodeStub stub, List<String> args) {
140134
return ResponseUtils.newErrorResponse(String.format("Error: state for %s is null", key));
141135
}
142136
_logger.info(String.format("Query Response:\nName: %s, Amount: %s\n", key, val));
143-
return ResponseUtils.newSuccessResponse(val, ByteString.copyFrom(val, UTF_8).toByteArray());
137+
return ResponseUtils.newSuccessResponse(val, val.getBytes(StandardCharsets.UTF_8));
144138
}
145139

146140
public static void main(String[] args) {
147141
new SimpleChaincode().start(args);
148142
}
149-
150143
}

0 commit comments

Comments
 (0)