mirror of
https://github.com/corda/corda.git
synced 2024-12-25 23:51:10 +00:00
CORDA-2871: Sanity fixes! (#63)
* Improve message for SandboxClassLoadingException. * Fix serialisation API for using sandboxed environment.
This commit is contained in:
parent
f68c4b3308
commit
7a6c18156c
@ -75,11 +75,17 @@ inline fun <reified T : Any> SerializedBytes<T>.deserializeFor(classLoader: Sand
|
||||
}
|
||||
|
||||
fun ByteSequence.deserializeTo(clazz: Class<*>, classLoader: SandboxClassLoader): Any {
|
||||
return deserializeTo(clazz, classLoader, SerializationFactory.defaultFactory)
|
||||
val factory = SerializationFactory.defaultFactory
|
||||
return deserializeTo(clazz, classLoader, factory, factory.defaultContext)
|
||||
}
|
||||
|
||||
fun ByteSequence.deserializeTo(clazz: Class<*>, classLoader: SandboxClassLoader, factory: SerializationFactory): Any {
|
||||
val obj = factory.deserialize(this, Any::class.java, factory.defaultContext)
|
||||
fun ByteSequence.deserializeTo(
|
||||
clazz: Class<*>,
|
||||
classLoader: SandboxClassLoader,
|
||||
factory: SerializationFactory,
|
||||
context: SerializationContext
|
||||
): Any {
|
||||
val obj = factory.deserialize(this, Any::class.java, context)
|
||||
return if (clazz.isInstance(obj)) {
|
||||
obj
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user