[CORDA-1617] Fix explorer login error handling. (#3365)

When specifying incorrect connection details for the nodes (e.g.,
  wrong port), an RPCException would be thrown which was not
  handled correctly, resulting in busy waiting on the UI thread.

  Ideally the login should not block the UI thread anyways, but
  for now this fix is the most pragmatic solution.
This commit is contained in:
Florian Friemel 2018-06-14 13:09:03 +01:00 committed by GitHub
parent 3d107200a1
commit 8f4973cd00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ import javafx.beans.property.SimpleObjectProperty
import net.corda.client.rpc.CordaRPCClient import net.corda.client.rpc.CordaRPCClient
import net.corda.client.rpc.CordaRPCClientConfiguration import net.corda.client.rpc.CordaRPCClientConfiguration
import net.corda.client.rpc.CordaRPCConnection import net.corda.client.rpc.CordaRPCConnection
import net.corda.client.rpc.RPCException
import net.corda.core.contracts.ContractState import net.corda.core.contracts.ContractState
import net.corda.core.flows.StateMachineRunId import net.corda.core.flows.StateMachineRunId
import net.corda.core.identity.Party import net.corda.core.identity.Party
@ -193,18 +194,22 @@ class NodeMonitorModel {
val nodeInfo = _connection.proxy.nodeInfo() val nodeInfo = _connection.proxy.nodeInfo()
require(nodeInfo.legalIdentitiesAndCerts.isNotEmpty()) require(nodeInfo.legalIdentitiesAndCerts.isNotEmpty())
_connection _connection
} catch (secEx: ActiveMQException) { } catch (throwable: Throwable) {
// Happens when: when (throwable) {
// * incorrect credentials provided; is ActiveMQException, is RPCException -> {
// * incorrect endpoint specified; // Happens when:
// - no point to retry connecting. // * incorrect credentials provided;
throw secEx // * incorrect endpoint specified;
} catch (th: Throwable) { // - no point to retry connecting.
// Deliberately not logging full stack trace as it will be full of internal stacktraces. throw throwable
logger.info("Exception upon establishing connection: " + th.message) }
null else -> {
// Deliberately not logging full stack trace as it will be full of internal stacktraces.
logger.info("Exception upon establishing connection: " + throwable.message)
null
}
}
} }
if (connection != null) { if (connection != null) {
logger.info("Connection successfully established with: $nodeHostAndPort") logger.info("Connection successfully established with: $nodeHostAndPort")
return connection return connection