Including FlowException in the RPC exception whitelist (CORDA-1264) (#3037)

These exceptions are designed to be propagated in P2P and so makes sense to keep them visible if the recipient is an RPC user.
This commit is contained in:
Shams Asari
2018-05-01 07:48:50 +01:00
committed by GitHub
parent 42edf58b92
commit adef57f127
3 changed files with 43 additions and 45 deletions

View File

@ -2,10 +2,12 @@ package net.corda.nodeapi.exceptions
import net.corda.core.CordaRuntimeException
import net.corda.core.contracts.TransactionVerificationException
import net.corda.core.flows.FlowException
import java.io.InvalidClassException
// could change to use package name matching but trying to avoid reflection for now
private val whitelisted = setOf(
FlowException::class,
InvalidClassException::class,
RpcSerializableError::class,
TransactionVerificationException::class
@ -23,7 +25,6 @@ class InternalNodeException(message: String) : CordaRuntimeException(message) {
fun defaultMessage(): String = DEFAULT_MESSAGE
fun obfuscateIfInternal(wrapped: Throwable): Throwable {
(wrapped as? CordaRuntimeException)?.setCause(null)
return when {
whitelisted.any { it.isInstance(wrapped) } -> wrapped