Skip to content

Commit 09a791c

Browse files
authored
Merge pull request #198 from gqqnbig/first-argument
First argument should be of type Context
2 parents 2b82693 + 734db71 commit 09a791c

File tree

1 file changed

+3
-1
lines changed
  • fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/routing/impl

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ public TxFunctionImpl(final Method m, final ContractDefinition contract) {
118118
Arrays.asList(method.getParameters()));
119119

120120
// validate the first one is a context object
121-
if (!Context.class.isAssignableFrom(params.get(0).getType())) {
121+
if (params.size() == 0) {
122+
throw new ContractRuntimeException("First argument should be of type Context");
123+
} else if (!Context.class.isAssignableFrom(params.get(0).getType())) {
122124
throw new ContractRuntimeException(
123125
"First argument should be of type Context " + method.getName() + " " + params.get(0).getType());
124126
} else {

0 commit comments

Comments
 (0)