From 7a6c18156c27d72e98eef85e6ee1cd46a5e4af00 Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Mon, 9 Sep 2019 18:14:33 +0100 Subject: [PATCH] CORDA-2871: Sanity fixes! (#63) * Improve message for SandboxClassLoadingException. * Fix serialisation API for using sandboxed environment. --- .../net/corda/djvm/serialization/Serialization.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/net/corda/djvm/serialization/Serialization.kt b/src/main/kotlin/net/corda/djvm/serialization/Serialization.kt index f774fe9bdd..bd15c6da6c 100644 --- a/src/main/kotlin/net/corda/djvm/serialization/Serialization.kt +++ b/src/main/kotlin/net/corda/djvm/serialization/Serialization.kt @@ -75,11 +75,17 @@ inline fun SerializedBytes.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 {