From fbb3fe0dfabc59ad4b7538706216d9b0c813dda5 Mon Sep 17 00:00:00 2001 From: Andrzej Cichocki Date: Tue, 1 Aug 2017 17:24:19 +0100 Subject: [PATCH] Avoid returning Throwable as Future value. (#1124) --- .../src/main/kotlin/net/corda/testing/driver/Driver.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test-utils/src/main/kotlin/net/corda/testing/driver/Driver.kt b/test-utils/src/main/kotlin/net/corda/testing/driver/Driver.kt index be56abf0b3..aa50d98eea 100644 --- a/test-utils/src/main/kotlin/net/corda/testing/driver/Driver.kt +++ b/test-utils/src/main/kotlin/net/corda/testing/driver/Driver.kt @@ -513,7 +513,7 @@ class DriverDSL( _executorService?.shutdownNow() } - private fun establishRpc(nodeAddress: NetworkHostAndPort, sslConfig: SSLConfiguration, processDeathFuture: ListenableFuture): ListenableFuture { + private fun establishRpc(nodeAddress: NetworkHostAndPort, sslConfig: SSLConfiguration, processDeathFuture: ListenableFuture): ListenableFuture { val client = CordaRPCClient(nodeAddress, sslConfig, initialiseSerialization = false) val connectionFuture = poll(executorService, "RPC connection") { try { @@ -526,7 +526,7 @@ class DriverDSL( } return firstOf(connectionFuture, processDeathFuture) { if (it == processDeathFuture) { - throw processDeathFuture.getOrThrow() + throw ListenProcessDeathException(nodeAddress, processDeathFuture.getOrThrow()) } val connection = connectionFuture.getOrThrow() shutdownManager.registerShutdown(connection::close) @@ -726,7 +726,7 @@ class DriverDSL( registerProcess(processFuture) return processFuture.flatMap { process -> val processDeathFuture = poll(executorService, "process death") { - if (process.isAlive) null else ListenProcessDeathException(nodeConfiguration.p2pAddress, process) + if (process.isAlive) null else process } // We continue to use SSL enabled port for RPC when its for node user. establishRpc(nodeConfiguration.p2pAddress, nodeConfiguration, processDeathFuture).flatMap { rpc -> @@ -736,7 +736,7 @@ class DriverDSL( }).flatMap { it } firstOf(processDeathFuture, networkMapFuture) { if (it == processDeathFuture) { - throw processDeathFuture.getOrThrow() + throw ListenProcessDeathException(nodeConfiguration.p2pAddress, process) } processDeathFuture.cancel(false) NodeHandle.OutOfProcess(rpc.nodeIdentity(), rpc, nodeConfiguration, webAddress, debugPort, process)