mirror of
https://github.com/corda/corda.git
synced 2025-01-18 18:56:28 +00:00
Merge pull request #5683 from corda/bugfix/CORDA-3396-fixed-blob-inspector-npe
CORDA-3396 fixed blob inspector npe
This commit is contained in:
commit
703318b5a0
@ -252,7 +252,7 @@ object JacksonSupport {
|
||||
writeObjectField("issuerUniqueID", value.issuerUniqueID)
|
||||
writeObjectField("subjectUniqueID", value.subjectUniqueID)
|
||||
writeObjectField("keyUsage", value.keyUsage?.asList()?.mapIndexedNotNull { i, flag -> if (flag) keyUsages[i] else null })
|
||||
writeObjectField("extendedKeyUsage", value.extendedKeyUsage.map { keyPurposeIds[it] ?: it })
|
||||
writeObjectField("extendedKeyUsage", value.extendedKeyUsage?.map { keyPurposeIds[it] ?: it })
|
||||
jsonObject("basicConstraints") {
|
||||
val isCa = value.basicConstraints != -1
|
||||
writeBooleanField("isCA", isCa)
|
||||
|
@ -12,6 +12,7 @@ import com.nhaarman.mockito_kotlin.any
|
||||
import com.nhaarman.mockito_kotlin.doReturn
|
||||
import com.nhaarman.mockito_kotlin.mock
|
||||
import com.nhaarman.mockito_kotlin.whenever
|
||||
import com.nhaarman.mockito_kotlin.spy
|
||||
import net.corda.client.jackson.internal.childrenAs
|
||||
import net.corda.client.jackson.internal.valueAs
|
||||
import net.corda.core.contracts.*
|
||||
@ -638,6 +639,14 @@ class JacksonSupportTest(@Suppress("unused") private val name: String, factory:
|
||||
assertThat(json["encoded"].binaryValue()).isEqualTo(cert.encoded)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `X509Certificate serialization when extendedKeyUsage is null`() {
|
||||
val cert: X509Certificate = spy(MINI_CORP.identity.certificate)
|
||||
whenever(cert.extendedKeyUsage).thenReturn(null)
|
||||
// should work even if extendedKeyUsage is null
|
||||
mapper.valueToTree<ObjectNode>(cert)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `X509Certificate deserialization`() {
|
||||
val cert: X509Certificate = MINI_CORP.identity.certificate
|
||||
|
@ -79,6 +79,11 @@ class BlobInspector : CordaCliWrapper("blob-inspector", "Convert AMQP serialised
|
||||
mapper.writeValue(out, deserialized)
|
||||
ExitCodes.SUCCESS
|
||||
} catch (e: Exception) {
|
||||
print("Unexpected exception: ${e.message}")
|
||||
if (verbose) {
|
||||
println()
|
||||
e.printStackTrace(System.out)
|
||||
}
|
||||
ExitCodes.FAILURE
|
||||
} finally {
|
||||
_contextSerializationEnv.set(null)
|
||||
|
Loading…
Reference in New Issue
Block a user