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

Usage of lambda in unwrap method in flow in Java makes it unable to be started by shell

    Details

    • Type: Bug
    • Status: Done (View workflow)
    • Priority: Low
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Severity:
      Medium
    • Target Version/s:
    • Feature Team:
      Corda Core
    • Sprint:

      Description

      The following code causes the exception when tried to run from the shell.

      @InitiatingFlow
          @StartableByRPC
          public static class Pimpus extends FlowLogic<Void> {
      
              private final Party party;
      
              public Pimpus(Party party) {
                  this.party = party;
              }
      
              @Suspendable
              @Override public Void call() throws FlowException {
      
                  FlowSession session = initiateFlow(party);
      
                  final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0);
      
                  Integer integer = session.receive(Integer.class).unwrap((i) -> i);
      //            Integer integer = 214;
                  return null;
              }
          }
      

      Commenting the line with unwrap method makes the flow start properly.
      To make things a bit more complicated, usage of other lambdas seems to be fine regardless - adding some stream operations for example has no effect in triggering this bug.

      Thu Jun 21 15:17:07 BST 2018>>> flow start Pimpus
      flow start Pimpus: exception: Could not parse as a command: Method $deserializeLambda$ missing parameter name at index 0
      Thu Jun 21 15:17:11 BST 2018>>> [ERROR] 15:17:11+0100 [pool-8-thread-5] command.CRaSHSession.execute - Error while evaluating request 'flow start Pimpus' flow start Pimpus: exception: Could not parse as a command: Method $deserializeLambda$ missing parameter name at index 0
       net.corda.client.jackson.StringToMethodCallParser$UnparseableCallException$ReflectionDataMissing: Could not parse as a command: Method $deserializeLambda$ missing parameter name at index 0
      	at net.corda.client.jackson.StringToMethodCallParser.paramNamesFromMethod(StringToMethodCallParser.kt:141) ~[corda-jackson-3.0.0-RC05.jar:?]
      	at net.corda.client.jackson.StringToMethodCallParser.<init>(StringToMethodCallParser.kt:112) ~[corda-jackson-3.0.0-RC05.jar:?]
      	at net.corda.tools.shell.InteractiveShell.runFlowFromString(InteractiveShell.kt:342) ~[corda-shell-3.0.0-RC05.jar:?]
      	at net.corda.tools.shell.InteractiveShell.runFlowByNameFragment(InteractiveShell.kt:285) ~[corda-shell-3.0.0-RC05.jar:?]
      	at net.corda.tools.shell.FlowShellCommand.startFlow(FlowShellCommand.java:72) ~[corda-shell-3.0.0-RC05.jar:?]
      	at net.corda.tools.shell.FlowShellCommand.start(FlowShellCommand.java:50) ~[corda-shell-3.0.0-RC05.jar:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
      	at org.crsh.cli.impl.lang.MethodDescriptor$1.invoke(MethodDescriptor.java:164) ~[crash.cli-cadb53544fbb3c0fb901445da614998a6a419488.jar:?]
      	at org.crsh.cli.impl.lang.MethodDescriptor$1.invoke(MethodDescriptor.java:106) ~[crash.cli-cadb53544fbb3c0fb901445da614998a6a419488.jar:?]
      	at org.crsh.lang.impl.java.ProducerCommandMatch$1.close(ProducerCommandMatch.java:117) ~[crash.shell-cadb53544fbb3c0fb901445da614998a6a419488.jar:?]
      	at org.crsh.shell.impl.command.pipeline.CommandInvokerAdapter.close(CommandInvokerAdapter.java:296) ~[crash.shell-cadb53544fbb3c0fb901445da614998a6a419488.jar:?]
      	at org.crsh.shell.impl.command.pipeline.PipeLine.close(PipeLine.java:106) ~[crash.shell-cadb53544fbb3c0fb901445da614998a6a419488.jar:?]
      	at org.crsh.shell.impl.command.spi.CommandInvoker.invoke(CommandInvoker.java:52) ~[crash.shell-cadb53544fbb3c0fb901445da614998a6a419488.jar:?]
      	at org.crsh.shell.impl.command.CRaSHCommandProcess.doInvoke(CRaSHCommandProcess.java:39) ~[crash.shell-cadb53544fbb3c0fb901445da614998a6a419488.jar:?]
      	at org.crsh.shell.impl.command.CRaSHProcess.execute(CRaSHProcess.java:60) [crash.shell-cadb53544fbb3c0fb901445da614998a6a419488.jar:?]
      	at org.crsh.shell.impl.async.AsyncProcess$2.call(AsyncProcess.java:207) [crash.shell-cadb53544fbb3c0fb901445da614998a6a419488.jar:?]
      	at org.crsh.shell.impl.async.AsyncProcess$2.call(AsyncProcess.java:177) [crash.shell-cadb53544fbb3c0fb901445da614998a6a419488.jar:?]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_144]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_144]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_144]
      	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
      

        Attachments

          Activity

            People

            • Assignee:
              Maks.Pawlak Maksymilian Pawlak (Inactive)
              Reporter:
              Maks.Pawlak Maksymilian Pawlak (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: