From e1853f50d443a74167d2b4cc2d74eacc5a61c0d8 Mon Sep 17 00:00:00 2001 From: Ryan Fowler Date: Mon, 3 Jun 2019 10:52:58 +0100 Subject: [PATCH] CORDA-2945: Catch IllegalArgumentException to avoid shutdown of NodeExplorer --- .../views/cordapps/cash/NewTransaction.kt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/explorer/src/main/kotlin/net/corda/explorer/views/cordapps/cash/NewTransaction.kt b/tools/explorer/src/main/kotlin/net/corda/explorer/views/cordapps/cash/NewTransaction.kt index b3210fe79a..5eb873e33c 100644 --- a/tools/explorer/src/main/kotlin/net/corda/explorer/views/cordapps/cash/NewTransaction.kt +++ b/tools/explorer/src/main/kotlin/net/corda/explorer/views/cordapps/cash/NewTransaction.kt @@ -151,14 +151,19 @@ class NewTransaction : Fragment() { val anonymous = true val defaultRef = OpaqueBytes.of(1) val issueRef = if (issueRef.value != null) OpaqueBytes.of(issueRef.value) else defaultRef - when (it) { - executeButton -> when (transactionTypeCB.value) { - CashTransaction.Issue -> IssueAndPaymentRequest(Amount.fromDecimal(amount.value, currencyChoiceBox.value), issueRef, partyBChoiceBox.value.party, selectNotary(), anonymous) - CashTransaction.Pay -> PaymentRequest(Amount.fromDecimal(amount.value, currencyChoiceBox.value), partyBChoiceBox.value.party, anonymous = anonymous, notary = selectNotary()) - CashTransaction.Exit -> ExitRequest(Amount.fromDecimal(amount.value, currencyChoiceBox.value), issueRef) + try { + when (it) { + executeButton -> when (transactionTypeCB.value) { + CashTransaction.Issue -> IssueAndPaymentRequest(Amount.fromDecimal(amount.value, currencyChoiceBox.value), issueRef, partyBChoiceBox.value.party, selectNotary(), anonymous) + CashTransaction.Pay -> PaymentRequest(Amount.fromDecimal(amount.value, currencyChoiceBox.value), partyBChoiceBox.value.party, anonymous = anonymous, notary = selectNotary()) + CashTransaction.Exit -> ExitRequest(Amount.fromDecimal(amount.value, currencyChoiceBox.value), issueRef) + else -> null + } else -> null } - else -> null + } catch (e: IllegalArgumentException) { + ExceptionDialog(e).showAndWait() + null } } }