mirror of
https://github.com/corda/corda.git
synced 2025-04-19 08:36:39 +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.net.*
|
||||
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
|
||||
@ -318,14 +317,14 @@ object AttachmentsClassLoaderBuilder {
|
||||
isAttachmentTrusted: (Attachment) -> Boolean,
|
||||
parent: ClassLoader = ClassLoader.getSystemClassLoader(),
|
||||
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)) {
|
||||
// Create classloader and load serializers, whitelisted classes
|
||||
val transactionClassLoader = AttachmentsClassLoader(attachments, params, txId, isAttachmentTrusted, parent)
|
||||
val serializers = createInstancesOfClassesImplementing(transactionClassLoader, SerializationCustomSerializer::class.java)
|
||||
val whitelistedClasses = ServiceLoader.load(SerializationWhitelist::class.java, transactionClassLoader)
|
||||
.flatMap { it.whitelist }
|
||||
.flatMap(SerializationWhitelist::whitelist)
|
||||
.toList()
|
||||
|
||||
// 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
|
||||
// like no-overlap, package namespace ownership and (in future) deterministic Java.
|
||||
return AttachmentsClassLoaderBuilder.withAttachmentsClassloaderContext(
|
||||
this.attachments + extraAttachments,
|
||||
attachments + extraAttachments,
|
||||
getParamsWithGoo(),
|
||||
id,
|
||||
isAttachmentTrusted = isAttachmentTrusted) { transactionClassLoader ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user