mirror of
https://github.com/corda/corda.git
synced 2025-05-05 10:13:14 +00:00
Merge pull request #872 from corda/merges/may-22-14-56
This commit is contained in:
commit
9446d8093d
@ -5178,8 +5178,6 @@ public final class net.corda.core.transactions.WireTransaction extends net.corda
|
|||||||
public static final net.corda.core.transactions.WireTransaction$Companion Companion
|
public static final net.corda.core.transactions.WireTransaction$Companion Companion
|
||||||
##
|
##
|
||||||
public static final class net.corda.core.transactions.WireTransaction$Companion extends java.lang.Object
|
public static final class net.corda.core.transactions.WireTransaction$Companion extends java.lang.Object
|
||||||
@NotNull
|
|
||||||
public final java.util.List<net.corda.core.transactions.ComponentGroup> createComponentGroups(java.util.List<net.corda.core.contracts.StateRef>, java.util.List<? extends net.corda.core.contracts.TransactionState<? extends net.corda.core.contracts.ContractState>>, java.util.List<? extends net.corda.core.contracts.Command<?>>, java.util.List<? extends net.corda.core.crypto.SecureHash>, net.corda.core.identity.Party, net.corda.core.contracts.TimeWindow)
|
|
||||||
##
|
##
|
||||||
public final class net.corda.core.utilities.ByteArrays extends java.lang.Object
|
public final class net.corda.core.utilities.ByteArrays extends java.lang.Object
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
package net.corda.core.transactions
|
package net.corda.core.transactions
|
||||||
|
|
||||||
|
import net.corda.core.CordaInternal
|
||||||
import net.corda.core.contracts.*
|
import net.corda.core.contracts.*
|
||||||
import net.corda.core.contracts.ComponentGroupEnum.*
|
import net.corda.core.contracts.ComponentGroupEnum.*
|
||||||
import net.corda.core.crypto.*
|
import net.corda.core.crypto.*
|
||||||
@ -236,11 +237,12 @@ class WireTransaction(componentGroups: List<ComponentGroup>, val privacySalt: Pr
|
|||||||
sig.verify(id)
|
sig.verify(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal companion object {
|
companion object {
|
||||||
/**
|
/**
|
||||||
* Creating list of [ComponentGroup] used in one of the constructors of [WireTransaction] required
|
* Creating list of [ComponentGroup] used in one of the constructors of [WireTransaction] required
|
||||||
* for backwards compatibility purposes.
|
* for backwards compatibility purposes.
|
||||||
*/
|
*/
|
||||||
|
@CordaInternal
|
||||||
fun createComponentGroups(inputs: List<StateRef>,
|
fun createComponentGroups(inputs: List<StateRef>,
|
||||||
outputs: List<TransactionState<ContractState>>,
|
outputs: List<TransactionState<ContractState>>,
|
||||||
commands: List<Command<*>>,
|
commands: List<Command<*>>,
|
||||||
|
@ -7,6 +7,9 @@ release, see :doc:`upgrade-notes`.
|
|||||||
Unreleased
|
Unreleased
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
* ``WireTransaction.Companion.createComponentGroups`` has been marked as ``@CordaInternal``. It was never intended to be
|
||||||
|
public and was already internal for Kotlin code.
|
||||||
|
|
||||||
* RPC Framework moved from Kryo to the Corda AMQP implementation [Corda-847]. This completes the removal
|
* RPC Framework moved from Kryo to the Corda AMQP implementation [Corda-847]. This completes the removal
|
||||||
of ``Kryo`` from general use within Corda, remaining only for use in flow checkpointing.
|
of ``Kryo`` from general use within Corda, remaining only for use in flow checkpointing.
|
||||||
|
|
||||||
|
@ -137,7 +137,10 @@ import net.corda.node.services.transactions.SimpleNotaryService
|
|||||||
import net.corda.node.services.transactions.ValidatingNotaryService
|
import net.corda.node.services.transactions.ValidatingNotaryService
|
||||||
import net.corda.node.services.upgrade.ContractUpgradeServiceImpl
|
import net.corda.node.services.upgrade.ContractUpgradeServiceImpl
|
||||||
import net.corda.node.services.vault.NodeVaultService
|
import net.corda.node.services.vault.NodeVaultService
|
||||||
import net.corda.node.utilities.*
|
import net.corda.node.utilities.AffinityExecutor
|
||||||
|
import net.corda.node.utilities.JVMAgentRegistry
|
||||||
|
import net.corda.node.utilities.NamedThreadFactory
|
||||||
|
import net.corda.node.utilities.NodeBuildProperties
|
||||||
import net.corda.nodeapi.internal.DevIdentityGenerator
|
import net.corda.nodeapi.internal.DevIdentityGenerator
|
||||||
import net.corda.nodeapi.internal.NodeInfoAndSigned
|
import net.corda.nodeapi.internal.NodeInfoAndSigned
|
||||||
import net.corda.nodeapi.internal.SignedNodeInfo
|
import net.corda.nodeapi.internal.SignedNodeInfo
|
||||||
@ -249,7 +252,7 @@ abstract class AbstractNode(val configuration: NodeConfiguration,
|
|||||||
|
|
||||||
val ops: CordaRPCOps = CordaRPCOpsImpl(services, smm, database, flowStarter, { shutdownExecutor.submit { stop() } })
|
val ops: CordaRPCOps = CordaRPCOpsImpl(services, smm, database, flowStarter, { shutdownExecutor.submit { stop() } })
|
||||||
// Mind that order is relevant here.
|
// Mind that order is relevant here.
|
||||||
val proxies = listOf(::AuthenticatedRpcOpsProxy, ::ExceptionSerialisingRpcOpsProxy)
|
val proxies = listOf<(CordaRPCOps) -> CordaRPCOps>(::AuthenticatedRpcOpsProxy, { it -> ExceptionSerialisingRpcOpsProxy(it, true) })
|
||||||
return proxies.fold(ops) { delegate, decorate -> decorate(delegate) }
|
return proxies.fold(ops) { delegate, decorate -> decorate(delegate) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,12 @@ class BrokerJaasLoginModule : BaseBrokerJaasLoginModule() {
|
|||||||
loginSucceeded = true
|
loginSucceeded = true
|
||||||
return true
|
return true
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
log.error("Login failed: ${e.message}", e)
|
// This is a known problem, so we swallow this exception. A peer will attempt to connect without presenting client certificates during SASL
|
||||||
|
if (e is IllegalArgumentException && e.stackTrace.any { it.className == "org.apache.activemq.artemis.protocol.amqp.sasl.PlainSASL" }) {
|
||||||
|
log.trace("SASL Login failed.")
|
||||||
|
} else {
|
||||||
|
log.error("Login failed: ${e.message}", e)
|
||||||
|
}
|
||||||
if (e is LoginException) {
|
if (e is LoginException) {
|
||||||
throw e
|
throw e
|
||||||
} else {
|
} else {
|
||||||
|
@ -13,6 +13,8 @@ package net.corda.node.internal.rpc.proxies
|
|||||||
import net.corda.core.CordaRuntimeException
|
import net.corda.core.CordaRuntimeException
|
||||||
import net.corda.core.CordaThrowable
|
import net.corda.core.CordaThrowable
|
||||||
import net.corda.core.concurrent.CordaFuture
|
import net.corda.core.concurrent.CordaFuture
|
||||||
|
import net.corda.core.doOnError
|
||||||
|
import net.corda.core.internal.concurrent.doOnError
|
||||||
import net.corda.core.internal.concurrent.mapError
|
import net.corda.core.internal.concurrent.mapError
|
||||||
import net.corda.core.mapErrors
|
import net.corda.core.mapErrors
|
||||||
import net.corda.core.messaging.CordaRPCOps
|
import net.corda.core.messaging.CordaRPCOps
|
||||||
@ -22,25 +24,30 @@ import net.corda.core.messaging.FlowHandleImpl
|
|||||||
import net.corda.core.messaging.FlowProgressHandle
|
import net.corda.core.messaging.FlowProgressHandle
|
||||||
import net.corda.core.messaging.FlowProgressHandleImpl
|
import net.corda.core.messaging.FlowProgressHandleImpl
|
||||||
import net.corda.core.serialization.CordaSerializable
|
import net.corda.core.serialization.CordaSerializable
|
||||||
|
import net.corda.core.utilities.loggerFor
|
||||||
import net.corda.node.internal.InvocationHandlerTemplate
|
import net.corda.node.internal.InvocationHandlerTemplate
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import java.lang.reflect.Method
|
import java.lang.reflect.Method
|
||||||
import java.lang.reflect.Proxy.newProxyInstance
|
import java.lang.reflect.Proxy.newProxyInstance
|
||||||
|
|
||||||
internal class ExceptionSerialisingRpcOpsProxy(private val delegate: CordaRPCOps) : CordaRPCOps by proxy(delegate) {
|
internal class ExceptionSerialisingRpcOpsProxy(private val delegate: CordaRPCOps, doLog: Boolean) : CordaRPCOps by proxy(delegate, doLog) {
|
||||||
private companion object {
|
private companion object {
|
||||||
private fun proxy(delegate: CordaRPCOps): CordaRPCOps {
|
private val logger = loggerFor<ExceptionSerialisingRpcOpsProxy>()
|
||||||
val handler = ErrorSerialisingInvocationHandler(delegate)
|
|
||||||
|
private fun proxy(delegate: CordaRPCOps, doLog: Boolean): CordaRPCOps {
|
||||||
|
val handler = ErrorSerialisingInvocationHandler(delegate, doLog)
|
||||||
return newProxyInstance(delegate::class.java.classLoader, arrayOf(CordaRPCOps::class.java), handler) as CordaRPCOps
|
return newProxyInstance(delegate::class.java.classLoader, arrayOf(CordaRPCOps::class.java), handler) as CordaRPCOps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ErrorSerialisingInvocationHandler(override val delegate: CordaRPCOps) : InvocationHandlerTemplate {
|
private class ErrorSerialisingInvocationHandler(override val delegate: CordaRPCOps, private val doLog: Boolean) : InvocationHandlerTemplate {
|
||||||
override fun invoke(proxy: Any, method: Method, arguments: Array<out Any?>?): Any? {
|
override fun invoke(proxy: Any, method: Method, arguments: Array<out Any?>?): Any? {
|
||||||
try {
|
try {
|
||||||
val result = super.invoke(proxy, method, arguments)
|
val result = super.invoke(proxy, method, arguments)
|
||||||
return result?.let { ensureSerialisable(it) }
|
return result?.let { ensureSerialisable(it) }
|
||||||
} catch (exception: Exception) {
|
} catch (exception: Exception) {
|
||||||
|
// In this special case logging and re-throwing is the right approach.
|
||||||
|
log(exception)
|
||||||
throw ensureSerialisable(exception)
|
throw ensureSerialisable(exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,15 +77,15 @@ internal class ExceptionSerialisingRpcOpsProxy(private val delegate: CordaRPCOps
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun <ELEMENT> wrapObservable(observable: Observable<ELEMENT>): Observable<ELEMENT> {
|
private fun <ELEMENT> wrapObservable(observable: Observable<ELEMENT>): Observable<ELEMENT> {
|
||||||
return observable.mapErrors(::ensureSerialisable)
|
return observable.doOnError(::log).mapErrors(::ensureSerialisable)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <SNAPSHOT, ELEMENT> wrapFeed(feed: DataFeed<SNAPSHOT, ELEMENT>): DataFeed<SNAPSHOT, ELEMENT> {
|
private fun <SNAPSHOT, ELEMENT> wrapFeed(feed: DataFeed<SNAPSHOT, ELEMENT>): DataFeed<SNAPSHOT, ELEMENT> {
|
||||||
return feed.mapErrors(::ensureSerialisable)
|
return feed.doOnError(::log).mapErrors(::ensureSerialisable)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <RESULT> wrapFuture(future: CordaFuture<RESULT>): CordaFuture<RESULT> {
|
private fun <RESULT> wrapFuture(future: CordaFuture<RESULT>): CordaFuture<RESULT> {
|
||||||
return future.mapError(::ensureSerialisable)
|
return future.doOnError(::log).mapError(::ensureSerialisable)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ensureSerialisable(error: Throwable): Throwable {
|
private fun ensureSerialisable(error: Throwable): Throwable {
|
||||||
@ -91,6 +98,12 @@ internal class ExceptionSerialisingRpcOpsProxy(private val delegate: CordaRPCOps
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun log(error: Throwable) {
|
||||||
|
if (doLog) {
|
||||||
|
logger.error("Error during RPC invocation", error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun superclasses(clazz: Class<*>): List<Class<*>> {
|
private fun superclasses(clazz: Class<*>): List<Class<*>> {
|
||||||
val superclasses = mutableListOf<Class<*>>()
|
val superclasses = mutableListOf<Class<*>>()
|
||||||
var current: Class<*>?
|
var current: Class<*>?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user