Merge branch 'release/os/4.6' into cc/merge/os-4.6-os-4.7/24-apr-2023

Fwd-merge from OS 4.6.
This commit is contained in:
Chris Cochrane 2023-04-24 20:13:50 +01:00
commit 91c38fa84b
No known key found for this signature in database
GPG Key ID: 4D4602B5BBC63950
13 changed files with 46 additions and 17 deletions

View File

@ -61,8 +61,9 @@ buildscript {
ext.asm_version = '7.1'
ext.artemis_version = '2.6.2'
// TODO Upgrade Jackson only when corda is using kotlin 1.3.10
ext.jackson_version = '2.9.7'
// TODO Upgrade to Jackson Kotlin 2.10+ only when corda is using kotlin 1.3.10
ext.jackson_version = '2.13.5'
ext.jackson_kotlin_version = '2.9.7'
ext.jetty_version = '9.4.19.v20190610'
ext.jersey_version = '2.25'
ext.servlet_version = '4.0.1'
@ -105,9 +106,9 @@ buildscript {
ext.dependency_checker_version = '5.2.0'
ext.commons_collections_version = '4.3'
ext.beanutils_version = '1.9.4'
ext.crash_version = '1.7.4'
ext.crash_version = '1.7.6'
ext.jsr305_version = constants.getProperty("jsr305Version")
ext.shiro_version = '1.4.1'
ext.shiro_version = '1.10.0'
ext.artifactory_plugin_version = constants.getProperty('artifactoryPluginVersion')
ext.hikari_version = '3.3.1'
ext.liquibase_version = '3.6.3'
@ -446,6 +447,10 @@ allprojects {
details.useVersion netty_version
}
}
if (details.requested.group == 'org.yaml' && details.requested.name == 'snakeyaml') {
details.useVersion snake_yaml_version
}
}
}
}

View File

@ -9,7 +9,9 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// Jackson and its plugins: parsing to/from JSON and other textual formats.
compile "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version"
compile("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_kotlin_version") {
exclude module: "jackson-databind"
}
// Yaml is useful for parsing strings to method calls.
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jackson_version"
// This adds support for java.time types.

View File

@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.*
import com.fasterxml.jackson.databind.*
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import com.fasterxml.jackson.databind.cfg.ConstructorDetector
import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier
import com.fasterxml.jackson.databind.deser.std.NumberDeserializers
import com.fasterxml.jackson.databind.node.ObjectNode
@ -179,6 +180,8 @@ object JacksonSupport {
addMixIn(X500Principal::class.java, X500PrincipalMixin::class.java)
addMixIn(X509Certificate::class.java, X509CertificateMixin::class.java)
addMixIn(CertPath::class.java, CertPathMixin::class.java)
setConstructorDetector(ConstructorDetector.DEFAULT.withAllowJDKTypeConstructors(true))
}
}

View File

@ -19,6 +19,7 @@ import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier
import com.fasterxml.jackson.databind.deser.ContextualDeserializer
import com.fasterxml.jackson.databind.deser.std.DelegatingDeserializer
import com.fasterxml.jackson.databind.deser.std.FromStringDeserializer
import com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy
import com.fasterxml.jackson.databind.introspect.AnnotatedClass
import com.fasterxml.jackson.databind.introspect.BasicClassIntrospector
import com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector
@ -117,6 +118,14 @@ private class CordaSerializableClassIntrospector(private val context: Module.Set
}
return super.constructPropertyCollector(config, ac, type, forSerialization, mutatorPrefix)
}
override fun constructPropertyCollector(config: MapperConfig<*>?, classDef: AnnotatedClass?, type: JavaType, forSerialization: Boolean, accNaming: AccessorNamingStrategy?): POJOPropertiesCollector {
if (hasCordaSerializable(type.rawClass)) {
// Adjust the field visibility of CordaSerializable classes on the fly as they are encountered.
context.configOverride(type.rawClass).visibility = Value.defaultVisibility().withFieldVisibility(Visibility.ANY)
}
return super.constructPropertyCollector(config, classDef, type, forSerialization, accNaming)
}
}
private class CordaSerializableBeanSerializerModifier : BeanSerializerModifier() {

View File

@ -26,7 +26,7 @@ disruptorVersion=3.4.2
typesafeConfigVersion=1.3.4
jsr305Version=3.0.2
artifactoryPluginVersion=4.16.1
snakeYamlVersion=1.19
snakeYamlVersion=1.33
caffeineVersion=2.7.0
metricsVersion=4.1.0
metricsNewRelicVersion=1.1.1

View File

@ -8,6 +8,7 @@ import net.corda.core.flows.*
import net.corda.core.identity.Party
import net.corda.core.internal.concurrent.transpose
import net.corda.core.messaging.startFlow
import net.corda.core.node.services.StatesNotAvailableException
import net.corda.core.node.services.queryBy
import net.corda.core.node.services.vault.QueryCriteria
import net.corda.core.transactions.TransactionBuilder
@ -69,7 +70,11 @@ class ScheduledFlowIntegrationTests {
val state = results.states.firstOrNull() ?: return
require(!state.state.data.processed) { "Cannot spend an already processed state" }
val lock = UUID.randomUUID()
serviceHub.vaultService.softLockReserve(lock, NonEmptySet.of(state.ref))
try {
serviceHub.vaultService.softLockReserve(lock, NonEmptySet.of(state.ref))
} catch (e: StatesNotAvailableException) {
return
}
val notary = state.state.notary
val outputState = SpentState(identity, ourIdentity, state.state.data.destination)
val builder = TransactionBuilder(notary)

View File

@ -4,6 +4,7 @@ import co.paralleluniverse.fibers.Suspendable
import net.corda.core.contracts.*
import net.corda.core.flows.*
import net.corda.core.identity.Party
import net.corda.core.node.services.StatesNotAvailableException
import net.corda.core.transactions.TransactionBuilder
import net.corda.core.utilities.NonEmptySet
import net.corda.testing.contracts.DummyContract
@ -25,7 +26,11 @@ class ScheduledFlow(private val stateRef: StateRef) : FlowLogic<Unit>() {
}
require(!scheduledState.processed) { "State should not have been previously processed" }
val lock = UUID.randomUUID()
serviceHub.vaultService.softLockReserve(lock, NonEmptySet.of(state.ref))
try {
serviceHub.vaultService.softLockReserve(lock, NonEmptySet.of(state.ref))
} catch (e: StatesNotAvailableException) {
return
}
val notary = state.state.notary
val newStateOutput = scheduledState.copy(processed = true)
val builder = TransactionBuilder(notary)

View File

@ -574,7 +574,7 @@ class CheckpointDumperImpl(private val checkpointStorage: CheckpointStorage, pri
private object MapSerializer : JsonSerializer<Map<Any, Any>>() {
override fun serialize(map: Map<Any, Any>, gen: JsonGenerator, serializers: SerializerProvider) {
gen.writeStartArray(map.size)
gen.writeStartArray()
map.forEach { (key, value) ->
gen.jsonObject {
writeObjectField("key", key)

View File

@ -16,7 +16,7 @@ dependencies {
cordaCompile project(':core')
compile("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version")
compile("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_kotlin_version")
// only included to control the `DemoClock` as part of the demo application
// normally `:node` should not be depended on in any CorDapps

View File

@ -70,7 +70,7 @@ dependencies {
}
compile('org.springframework.boot:spring-boot-starter-log4j2')
runtimeOnly("org.apache.logging.log4j:log4j-web:$log4j_version")
compile("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version")
compile("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_kotlin_version")
compile project(":client:rpc")
compile project(":client:jackson")
compile project(":finance:workflows")

View File

@ -82,10 +82,10 @@ include 'tools:checkpoint-agent'
include 'samples:attachment-demo:contracts'
include 'samples:attachment-demo:workflows'
include 'samples:trader-demo:workflows-trader'
include 'samples:irs-demo'
include 'samples:irs-demo:cordapp:contracts-irs'
include 'samples:irs-demo:cordapp:workflows-irs'
include 'samples:irs-demo:web'
// include 'samples:irs-demo'
// include 'samples:irs-demo:cordapp:contracts-irs'
// include 'samples:irs-demo:cordapp:workflows-irs'
// include 'samples:irs-demo:web'
include 'samples:simm-valuation-demo'
include 'samples:simm-valuation-demo:flows'
include 'samples:simm-valuation-demo:contracts-states'

View File

@ -6,7 +6,7 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version"
compile "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_kotlin_version"
compile "org.junit.jupiter:junit-jupiter-api:${junit_jupiter_version}"
compile "junit:junit:${junit_version}"

View File

@ -52,7 +52,7 @@ dependencies {
compile "com.typesafe:config:$typesafe_config_version"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version"
compile "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_kotlin_version"
compile "info.picocli:picocli:$picocli_version"
// TornadoFX: A lightweight Kotlin framework for working with JavaFX UI's.