mirror of
https://github.com/corda/corda.git
synced 2025-06-07 01:41:44 +00:00
Minor lambda simplifications and removing unused import.
This commit is contained in:
parent
c15d6e9d62
commit
58f7fb9d4e
@ -19,7 +19,6 @@ import java.io.IOException
|
|||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.net.*
|
import java.net.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.jar.JarInputStream
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A custom ClassLoader that knows how to load classes from a set of attachments. The attachments themselves only
|
* A custom ClassLoader that knows how to load classes from a set of attachments. The attachments themselves only
|
||||||
@ -318,14 +317,14 @@ object AttachmentsClassLoaderBuilder {
|
|||||||
isAttachmentTrusted: (Attachment) -> Boolean,
|
isAttachmentTrusted: (Attachment) -> Boolean,
|
||||||
parent: ClassLoader = ClassLoader.getSystemClassLoader(),
|
parent: ClassLoader = ClassLoader.getSystemClassLoader(),
|
||||||
block: (ClassLoader) -> T): T {
|
block: (ClassLoader) -> T): T {
|
||||||
val attachmentIds = attachments.map { it.id }.toSet()
|
val attachmentIds = attachments.map(Attachment::id).toSet()
|
||||||
|
|
||||||
val serializationContext = cache.computeIfAbsent(Key(attachmentIds, params)) {
|
val serializationContext = cache.computeIfAbsent(Key(attachmentIds, params)) {
|
||||||
// Create classloader and load serializers, whitelisted classes
|
// Create classloader and load serializers, whitelisted classes
|
||||||
val transactionClassLoader = AttachmentsClassLoader(attachments, params, txId, isAttachmentTrusted, parent)
|
val transactionClassLoader = AttachmentsClassLoader(attachments, params, txId, isAttachmentTrusted, parent)
|
||||||
val serializers = createInstancesOfClassesImplementing(transactionClassLoader, SerializationCustomSerializer::class.java)
|
val serializers = createInstancesOfClassesImplementing(transactionClassLoader, SerializationCustomSerializer::class.java)
|
||||||
val whitelistedClasses = ServiceLoader.load(SerializationWhitelist::class.java, transactionClassLoader)
|
val whitelistedClasses = ServiceLoader.load(SerializationWhitelist::class.java, transactionClassLoader)
|
||||||
.flatMap { it.whitelist }
|
.flatMap(SerializationWhitelist::whitelist)
|
||||||
.toList()
|
.toList()
|
||||||
|
|
||||||
// Create a new serializationContext for the current transaction. In this context we will forbid
|
// Create a new serializationContext for the current transaction. In this context we will forbid
|
||||||
|
@ -151,7 +151,7 @@ private constructor(
|
|||||||
// Switch thread local deserialization context to using a cached attachments classloader. This classloader enforces various rules
|
// Switch thread local deserialization context to using a cached attachments classloader. This classloader enforces various rules
|
||||||
// like no-overlap, package namespace ownership and (in future) deterministic Java.
|
// like no-overlap, package namespace ownership and (in future) deterministic Java.
|
||||||
return AttachmentsClassLoaderBuilder.withAttachmentsClassloaderContext(
|
return AttachmentsClassLoaderBuilder.withAttachmentsClassloaderContext(
|
||||||
this.attachments + extraAttachments,
|
attachments + extraAttachments,
|
||||||
getParamsWithGoo(),
|
getParamsWithGoo(),
|
||||||
id,
|
id,
|
||||||
isAttachmentTrusted = isAttachmentTrusted) { transactionClassLoader ->
|
isAttachmentTrusted = isAttachmentTrusted) { transactionClassLoader ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user