Merge pull request #7347 from corda/parkri/ENT-9838-deserialization-logger

ENT-9838 DeserializationInput creates a logger each time.
This commit is contained in:
Adel El-Beik 2023-04-26 12:05:07 +01:00 committed by GitHub
commit 32326a168f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,8 +2,8 @@ package net.corda.serialization.internal.amqp
import net.corda.core.KeepForDJVM
import net.corda.core.internal.VisibleForTesting
import net.corda.core.serialization.EncodingWhitelist
import net.corda.core.serialization.AMQP_ENVELOPE_CACHE_PROPERTY
import net.corda.core.serialization.EncodingWhitelist
import net.corda.core.serialization.SerializationContext
import net.corda.core.serialization.SerializedBytes
import net.corda.core.utilities.ByteSequence
@ -21,7 +21,6 @@ import org.apache.qpid.proton.amqp.UnsignedInteger
import org.apache.qpid.proton.codec.Data
import java.io.InputStream
import java.io.NotSerializableException
import java.lang.Exception
import java.lang.reflect.ParameterizedType
import java.lang.reflect.Type
import java.lang.reflect.TypeVariable
@ -41,16 +40,17 @@ class DeserializationInput constructor(
private val serializerFactory: SerializerFactory
) {
private val objectHistory: MutableList<Any> = mutableListOf()
private val logger = loggerFor<DeserializationInput>()
companion object {
private val logger = loggerFor<DeserializationInput>()
@VisibleForTesting
@Throws(AMQPNoTypeNotSerializableException::class)
fun <T> withDataBytes(
byteSequence: ByteSequence,
encodingWhitelist: EncodingWhitelist,
task: (ByteBuffer) -> T
) : T {
): T {
// Check that the lead bytes match expected header
val amqpSequence = amqpMagic.consume(byteSequence)
?: throw AMQPNoTypeNotSerializableException("Serialization header does not match.")