Skip to content

Commit 1528813

Browse files
author
Joel Dudley
authored
Don't fail silently when running flow with no progress tracker from shell.
2 parents 66c35bb + 83dc1d0 commit 1528813

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

node/src/main/kotlin/net/corda/node/shell/InteractiveShell.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ object InteractiveShell {
293293
continue
294294
}
295295
val flow = ctor.newInstance(*args) as FlowLogic<*>
296+
if (flow.progressTracker == null) {
297+
errors.add("A flow must override the progress tracker in order to be run from the shell")
298+
continue
299+
}
296300
return invoke(flow)
297301
} catch(e: StringToMethodCallParser.UnparseableCallException.MissingParameter) {
298302
errors.add("${getPrototype()}: missing parameter ${e.paramName}")

node/src/test/kotlin/net/corda/node/InteractiveShellTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import net.corda.core.node.ServiceHub
1111
import net.corda.core.transactions.SignedTransaction
1212
import net.corda.core.utilities.UntrustworthyData
1313
import net.corda.client.jackson.JacksonSupport
14+
import net.corda.core.utilities.ProgressTracker
1415
import net.corda.node.services.identity.InMemoryIdentityService
1516
import net.corda.node.shell.InteractiveShell
1617
import net.corda.testing.DUMMY_CA
@@ -30,6 +31,7 @@ class InteractiveShellTest {
3031
constructor(pair: Pair<Amount<Currency>, SecureHash.SHA256>) : this(pair.toString())
3132
constructor(party: Party) : this(party.name.toString())
3233

34+
override val progressTracker = ProgressTracker()
3335
override fun call() = a
3436
}
3537

0 commit comments

Comments
 (0)