Uploaded image for project: 'Corda'
  1. CORDA-2632

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

    Details

    • Type: Bug
    • Status: Done (View workflow)
    • Priority: Medium
    • Resolution: Done
    • Affects versions: Corda 4
    • Fix versions: Corda 4.1
    • Components: None
    • Labels:
      None
    • Severity:
      Medium
    • Target Version/s:
    • Feature Team:
      Operational Experience
    • Sprint:

      Description

      Example:

      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:

      [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:

      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:

      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".

        Attachments

          Activity

            People

            • Assignee:
              stefan.iliev Stefan Iliev
              Reporter:
              Roger.Willis Roger Willis
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: