From ebbca94d67970a617f316e7da0e43bab3022abef Mon Sep 17 00:00:00 2001 From: joeldudleyr3 Date: Thu, 31 Aug 2017 22:38:33 +0100 Subject: [PATCH 1/3] Show error msg rather than fail silently when running a flow with no progress tracker from the shell. --- node/src/main/kotlin/net/corda/node/shell/InteractiveShell.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/node/src/main/kotlin/net/corda/node/shell/InteractiveShell.kt b/node/src/main/kotlin/net/corda/node/shell/InteractiveShell.kt index f764c595b1..5c07570419 100644 --- a/node/src/main/kotlin/net/corda/node/shell/InteractiveShell.kt +++ b/node/src/main/kotlin/net/corda/node/shell/InteractiveShell.kt @@ -293,6 +293,10 @@ object InteractiveShell { continue } val flow = ctor.newInstance(*args) as FlowLogic<*> + if (flow.progressTracker == null) { + errors.add("You must override the flow's progress tracker to run it from the shell") + continue + } return invoke(flow) } catch(e: StringToMethodCallParser.UnparseableCallException.MissingParameter) { errors.add("${getPrototype()}: missing parameter ${e.paramName}") From 54e302608f257fa8ecb74b5b17eafa0862bb878e Mon Sep 17 00:00:00 2001 From: joeldudleyr3 Date: Fri, 1 Sep 2017 10:07:34 +0100 Subject: [PATCH 2/3] Updates the error message. --- node/src/main/kotlin/net/corda/node/shell/InteractiveShell.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/src/main/kotlin/net/corda/node/shell/InteractiveShell.kt b/node/src/main/kotlin/net/corda/node/shell/InteractiveShell.kt index 5c07570419..cc863b3193 100644 --- a/node/src/main/kotlin/net/corda/node/shell/InteractiveShell.kt +++ b/node/src/main/kotlin/net/corda/node/shell/InteractiveShell.kt @@ -294,7 +294,7 @@ object InteractiveShell { } val flow = ctor.newInstance(*args) as FlowLogic<*> if (flow.progressTracker == null) { - errors.add("You must override the flow's progress tracker to run it from the shell") + errors.add("A flow must override the progress tracker in order to be run from the shell") continue } return invoke(flow) From 83dc1d020d03519307a4630861bdc16289df57cf Mon Sep 17 00:00:00 2001 From: joeldudleyr3 Date: Fri, 1 Sep 2017 10:50:13 +0100 Subject: [PATCH 3/3] Fixes tests. --- node/src/test/kotlin/net/corda/node/InteractiveShellTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/node/src/test/kotlin/net/corda/node/InteractiveShellTest.kt b/node/src/test/kotlin/net/corda/node/InteractiveShellTest.kt index bd2ae43f57..a7cdbe34d7 100644 --- a/node/src/test/kotlin/net/corda/node/InteractiveShellTest.kt +++ b/node/src/test/kotlin/net/corda/node/InteractiveShellTest.kt @@ -11,6 +11,7 @@ import net.corda.core.node.ServiceHub import net.corda.core.transactions.SignedTransaction import net.corda.core.utilities.UntrustworthyData import net.corda.client.jackson.JacksonSupport +import net.corda.core.utilities.ProgressTracker import net.corda.node.services.identity.InMemoryIdentityService import net.corda.node.shell.InteractiveShell import net.corda.testing.DUMMY_CA @@ -30,6 +31,7 @@ class InteractiveShellTest { constructor(pair: Pair, SecureHash.SHA256>) : this(pair.toString()) constructor(party: Party) : this(party.name.toString()) + override val progressTracker = ProgressTracker() override fun call() = a }