We're updating the issue view to help you get more done. 

uploadAttachment via shell can fail with unhelpful message if the result of the command is unsuccessful

Description

Example:

1 2 3 run uploadAttachment jar: foo.jar Could not parse as a command: foo.jar Please try 'man run' to learn what syntax is acceptable

The following is seen in the logs:

1 [ERROR] 2019-02-18T11:48:51,784Z [rpc-server-handler-pool-3] proxies.ExceptionMaskingRpcOpsProxy.log - Error during RPC invocation [errorCode=1v2hkg9, moreInformationAt=https://errors.corda.net/OS/4.0-RC05/1v2hkg9] {actor_id=user1, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, invocation_id=a0fe5c37-43e3-4ea4-ba6a-6e6759f49c82, invocation_timestamp=2019-02-18T11:48:51.721Z, origin=user1, session_id=9dbdaa5f-5624-4258-8f2e-1c20411bb05d, session_timestamp=2019-02-18T11:26:26.281Z}

Instead, the command should fail with something like: "foo.jar cannot be found".

SECONDLY....

Uploading something which is not a JAR yields the following:

1 2 Mon Feb 18 13:12:01 GMT 2019>>> run uploadAttachment jar: node.conf RPC failed: net.corda.nodeapi.exceptions.InternalNodeException: Something went wrong within the Corda node.

We see:

1 2 3 4 5 6 7 8 9 java.lang.IllegalArgumentException: Stream is either empty or not a JAR/ZIP at net.corda.node.services.persistence.NodeAttachmentService$Companion.checkIsAValidJAR(NodeAttachmentService.kt:86) ~[corda-node-4.0-RC05.jar:?] at net.corda.node.services.persistence.NodeAttachmentService$Companion.access$checkIsAValidJAR(NodeAttachmentService.kt:65) ~[corda-node-4.0-RC05.jar:?] at net.corda.node.services.persistence.NodeAttachmentService$import$1$1.invoke(NodeAttachmentService.kt:360) ~[corda-node-4.0-RC05.jar:?] at net.corda.node.services.persistence.NodeAttachmentService$import$1$1.invoke(NodeAttachmentService.kt:52) ~[corda-node-4.0-RC05.jar:?] at net.corda.nodeapi.internal.ContractsScanningKt.withContractsInJar(ContractsScanning.kt:55) ~[corda-node-api-4.0-RC05.jar:?] at net.corda.node.services.persistence.NodeAttachmentService$import$1.invoke(NodeAttachmentService.kt:348) ~[corda-node-4.0-RC05.jar:?] at net.corda.node.services.persistence.NodeAttachmentService$import$1.invoke(NodeAttachmentService.kt:52) ~[corda-node-4.0-RC05.jar:?] at net.corda.nodeapi.internal.persistence.CordaPersistence.inTopLevelTransaction(CordaPersistence.kt:236) ~[corda-node-api-4.0-RC05.jar:?]

in the logs, which seems about right. Looks like that exception is being masked by the generic "something went wrong" exception.

The shell should really respond with something like "X is not a JAR".

Status

Assignee

Stefan Iliev

Reporter

Roger Willis

Priority

Medium

Labels

None

Severity

Medium

Fix versions

Ported to...

None

Feature Team

Operational Experience

Affects versions

Corda 4