mirror of
https://github.com/corda/corda.git
synced 2025-06-21 16:49:45 +00:00
CORDA-3335 Corda Shell flow kill - better warning for misformatted flow ID (#5601)
* CORDA-3081 warn that flow ID passed to flow kill is malformed as due to JDK8 doesn't fully validate it (JDK8 bug https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8159339) * CORDA-3335 Corda Shell flow kill - better warning for misformatted flow ID - exit earlier and don't RPC to node, refactoring for detekt
This commit is contained in:
committed by
Anthony Keenan
parent
5da114caa3
commit
b524c6368b
@ -97,6 +97,7 @@ object InteractiveShell {
|
|||||||
private var classLoader: ClassLoader? = null
|
private var classLoader: ClassLoader? = null
|
||||||
private lateinit var shellConfiguration: ShellConfiguration
|
private lateinit var shellConfiguration: ShellConfiguration
|
||||||
private var onExit: () -> Unit = {}
|
private var onExit: () -> Unit = {}
|
||||||
|
private const val uuidStringSize = 36
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getCordappsClassloader() = classLoader
|
fun getCordappsClassloader() = classLoader
|
||||||
@ -425,7 +426,14 @@ object InteractiveShell {
|
|||||||
log.error("Failed to parse flow ID", e)
|
log.error("Failed to parse flow ID", e)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//auxiliary validation - workaround for JDK8 bug https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8159339
|
||||||
|
if (id.length < uuidStringSize) {
|
||||||
|
val msg = "Can not kill the flow. Flow ID of '$id' seems to be malformed - a UUID should have $uuidStringSize characters. " +
|
||||||
|
"Expand the terminal window to see the full UUID value."
|
||||||
|
output.println(msg, Color.red)
|
||||||
|
log.warn(msg)
|
||||||
|
return
|
||||||
|
}
|
||||||
if (rpcOps.killFlow(runId)) {
|
if (rpcOps.killFlow(runId)) {
|
||||||
output.println("Killed flow $runId", Color.yellow)
|
output.println("Killed flow $runId", Color.yellow)
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user