mirror of
https://github.com/corda/corda.git
synced 2025-01-18 18:56:28 +00:00
ENT-1463: Replace getStackTraceAsString() with Throwable.initCause(). (#3101)
This commit is contained in:
parent
bb95156262
commit
fe88e9907c
@ -58,7 +58,6 @@ import kotlin.reflect.KClass
|
||||
import kotlin.reflect.full.createInstance
|
||||
|
||||
val Throwable.rootCause: Throwable get() = cause?.rootCause ?: this
|
||||
fun Throwable.getStackTraceAsString() = StringWriter().also { printStackTrace(PrintWriter(it)) }.toString()
|
||||
|
||||
infix fun Temporal.until(endExclusive: Temporal): Duration = Duration.between(this, endExclusive)
|
||||
|
||||
|
@ -2,7 +2,6 @@ package net.corda.nodeapi.internal.serialization.amqp
|
||||
|
||||
import com.esotericsoftware.kryo.io.ByteBufferInputStream
|
||||
import net.corda.core.internal.VisibleForTesting
|
||||
import net.corda.core.internal.getStackTraceAsString
|
||||
import net.corda.core.serialization.EncodingWhitelist
|
||||
import net.corda.core.serialization.SerializationContext
|
||||
import net.corda.core.serialization.SerializedBytes
|
||||
@ -95,7 +94,7 @@ class DeserializationInput @JvmOverloads constructor(private val serializerFacto
|
||||
|
||||
|
||||
@Throws(NotSerializableException::class)
|
||||
fun getEnvelope(byteSequence: ByteSequence) = Companion.getEnvelope(byteSequence, encodingWhitelist)
|
||||
fun getEnvelope(byteSequence: ByteSequence) = getEnvelope(byteSequence, encodingWhitelist)
|
||||
|
||||
@Throws(NotSerializableException::class)
|
||||
inline fun <reified T : Any> deserialize(bytes: SerializedBytes<T>, context: SerializationContext): T =
|
||||
@ -109,7 +108,7 @@ class DeserializationInput @JvmOverloads constructor(private val serializerFacto
|
||||
} catch (nse: NotSerializableException) {
|
||||
throw nse
|
||||
} catch (t: Throwable) {
|
||||
throw NotSerializableException("Unexpected throwable: ${t.message} ${t.getStackTraceAsString()}")
|
||||
throw NotSerializableException("Unexpected throwable: ${t.message}").apply { initCause(t) }
|
||||
} finally {
|
||||
objectHistory.clear()
|
||||
}
|
||||
@ -163,7 +162,7 @@ class DeserializationInput @JvmOverloads constructor(private val serializerFacto
|
||||
if (!objectRetrieved::class.java.isSubClassOf(type.asClass()!!)) {
|
||||
throw NotSerializableException(
|
||||
"Existing reference type mismatch. Expected: '$type', found: '${objectRetrieved::class.java}' " +
|
||||
"@ ${objectIndex}")
|
||||
"@ $objectIndex")
|
||||
}
|
||||
objectRetrieved
|
||||
} else {
|
||||
|
@ -487,7 +487,7 @@ class SerializationOutputTests(private val compression: CordaSerializationEncodi
|
||||
copy[valueIndex] = 0x00
|
||||
assertThatExceptionOfType(NotSerializableException::class.java).isThrownBy {
|
||||
des.deserialize(OpaqueBytes(copy), NonZeroByte::class.java, testSerializationContext)
|
||||
}.withMessageContaining("Zero not allowed")
|
||||
}.withStackTraceContaining("Zero not allowed")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user