From 080be7f40c1a5441cfd05f3b36a14b139221b5e6 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Wed, 4 May 2022 14:59:38 +0200 Subject: [PATCH] GH-739 Add DEBUG log statement for when type conversion fails Resolves #739 --- dep.txt | 158 ++++++++++++++++++ .../SmartCompositeMessageConverter.java | 18 +- 2 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 dep.txt diff --git a/dep.txt b/dep.txt new file mode 100644 index 000000000..ca45143cb --- /dev/null +++ b/dep.txt @@ -0,0 +1,158 @@ +[INFO] Scanning for projects... +[WARNING] +[WARNING] Some problems were encountered while building the effective model for org.springframework.cloud:spring-cloud-function-context:jar:4.0.0-SNAPSHOT +[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.fasterxml.jackson.core:jackson-databind:jar -> duplicate declaration of version (?) @ line 94, column 15 +[WARNING] +[WARNING] Some problems were encountered while building the effective model for org.springframework.cloud:spring-cloud-function-adapter-aws:jar:4.0.0-SNAPSHOT +[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework.boot:spring-boot-starter-test:jar -> duplicate declaration of version (?) @ line 118, column 15 +[WARNING] +[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. +[WARNING] +[WARNING] For this reason, future Maven versions might no longer support building such malformed projects. +[WARNING] +[INFO] +[INFO] ------< org.springframework.cloud:spring-cloud-function-context >------- +[INFO] Building spring-cloud-function-context 4.0.0-SNAPSHOT +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ spring-cloud-function-context --- +[INFO] org.springframework.cloud:spring-cloud-function-context:jar:4.0.0-SNAPSHOT +[INFO] +- net.jodah:typetools:jar:0.6.2:compile +[INFO] +- org.springframework.boot:spring-boot-autoconfigure:jar:3.0.0-SNAPSHOT:compile +[INFO] | \- org.springframework.boot:spring-boot:jar:3.0.0-SNAPSHOT:compile +[INFO] | \- org.springframework:spring-context:jar:6.0.0-SNAPSHOT:compile +[INFO] | +- org.springframework:spring-aop:jar:6.0.0-SNAPSHOT:compile +[INFO] | \- org.springframework:spring-expression:jar:6.0.0-SNAPSHOT:compile +[INFO] +- org.springframework.cloud:spring-cloud-function-core:jar:4.0.0-SNAPSHOT:compile +[INFO] | +- io.projectreactor:reactor-core:jar:3.4.17:compile +[INFO] | | \- org.reactivestreams:reactive-streams:jar:1.0.3:compile +[INFO] | \- org.springframework:spring-core:jar:6.0.0-SNAPSHOT:compile +[INFO] | \- org.springframework:spring-jcl:jar:6.0.0-SNAPSHOT:compile +[INFO] +- org.springframework:spring-messaging:jar:6.0.0-SNAPSHOT:compile +[INFO] | \- org.springframework:spring-beans:jar:6.0.0-SNAPSHOT:compile +[INFO] +- org.springframework:spring-web:jar:6.0.0-SNAPSHOT:compile +[INFO] +- com.fasterxml.jackson.module:jackson-module-kotlin:jar:2.13.2:compile +[INFO] | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.2:compile +[INFO] +- javax.annotation:javax.annotation-api:jar:1.3.2:compile +[INFO] +- javax.activation:javax.activation-api:jar:1.2.0:compile +[INFO] +- org.springframework.boot:spring-boot-configuration-processor:jar:3.0.0-SNAPSHOT:compile +[INFO] +- com.google.code.gson:gson:jar:2.9.0:compile +[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.2.1:compile +[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.13.2:compile +[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:3.0.0-SNAPSHOT:compile +[INFO] | +- org.springframework.boot:spring-boot-starter:jar:3.0.0-SNAPSHOT:compile +[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:3.0.0-SNAPSHOT:compile +[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.11:compile +[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.11:compile +[INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.2:compile +[INFO] | | | | \- org.apache.logging.log4j:log4j-api:jar:2.17.2:compile +[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile +[INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:2.0.0:compile +[INFO] | | \- org.yaml:snakeyaml:jar:1.30:compile +[INFO] | +- org.springframework.boot:spring-boot-test:jar:3.0.0-SNAPSHOT:compile +[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:3.0.0-SNAPSHOT:compile +[INFO] | +- com.jayway.jsonpath:json-path:jar:2.7.0:compile +[INFO] | | \- net.minidev:json-smart:jar:2.4.8:compile +[INFO] | | \- net.minidev:accessors-smart:jar:2.4.8:compile +[INFO] | | \- org.ow2.asm:asm:jar:9.1:compile +[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:3.0.1:compile +[INFO] | | \- com.sun.activation:jakarta.activation:jar:2.0.1:compile +[INFO] | +- org.assertj:assertj-core:jar:3.22.0:compile +[INFO] | +- org.hamcrest:hamcrest:jar:2.2:compile +[INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.8.2:compile +[INFO] | | +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:compile +[INFO] | | | +- org.opentest4j:opentest4j:jar:1.2.0:compile +[INFO] | | | +- org.junit.platform:junit-platform-commons:jar:1.8.2:compile +[INFO] | | | \- org.apiguardian:apiguardian-api:jar:1.1.2:compile +[INFO] | | +- org.junit.jupiter:junit-jupiter-params:jar:5.8.2:compile +[INFO] | | \- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:runtime +[INFO] | | \- org.junit.platform:junit-platform-engine:jar:1.8.2:runtime +[INFO] | +- org.mockito:mockito-core:jar:4.5.0:compile +[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.12.9:compile +[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.12.9:compile +[INFO] | | \- org.objenesis:objenesis:jar:3.2:runtime +[INFO] | +- org.mockito:mockito-junit-jupiter:jar:4.5.0:compile +[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:compile +[INFO] | +- org.springframework:spring-test:jar:6.0.0-SNAPSHOT:compile +[INFO] | \- org.xmlunit:xmlunit-core:jar:2.9.0:compile +[INFO] +- io.projectreactor:reactor-test:jar:3.4.17:test +[INFO] +- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.6.21:compile +[INFO] | +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.6.21:compile +[INFO] | | +- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.6.21:compile +[INFO] | | \- org.jetbrains:annotations:jar:13.0:compile +[INFO] | \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.6.21:compile +[INFO] +- org.jetbrains.kotlin:kotlin-reflect:jar:1.6.21:compile +[INFO] +- org.jetbrains.kotlinx:kotlinx-coroutines-reactor:jar:1.6.1:compile +[INFO] | +- org.jetbrains.kotlinx:kotlinx-coroutines-reactive:jar:1.6.1:compile +[INFO] | \- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:jar:1.6.1:compile +[INFO] +- org.apache.avro:avro:jar:1.10.2:compile +[INFO] | +- org.apache.commons:commons-compress:jar:1.20:compile +[INFO] | \- org.slf4j:slf4j-api:jar:1.7.36:compile +[INFO] +- io.cloudevents:cloudevents-spring:jar:2.2.0:compile +[INFO] | \- io.cloudevents:cloudevents-core:jar:2.2.0:compile +[INFO] | \- io.cloudevents:cloudevents-api:jar:2.2.0:compile +[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:3.0.0-SNAPSHOT:compile +[INFO] | \- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:3.0.0-SNAPSHOT:compile +[INFO] | +- org.springframework.boot:spring-boot-actuator:jar:3.0.0-SNAPSHOT:compile +[INFO] | \- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.2:runtime +[INFO] +- io.micrometer:micrometer-observation:jar:2.0.0-SNAPSHOT:compile +[INFO] | \- io.micrometer:micrometer-commons:jar:2.0.0-SNAPSHOT:compile +[INFO] +- io.micrometer:micrometer-core:jar:2.0.0-SNAPSHOT:compile +[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile +[INFO] | \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime +[INFO] +- io.micrometer:micrometer-tracing-api:jar:1.0.0-SNAPSHOT:compile +[INFO] | \- aopalliance:aopalliance:jar:1.0:compile +[INFO] \- io.micrometer:micrometer-tracing-integration-test:jar:1.0.0-SNAPSHOT:test +[INFO] +- io.micrometer:micrometer-tracing-test:jar:1.0.0-SNAPSHOT:test +[INFO] +- io.micrometer:micrometer-tracing-reporter-wavefront:jar:1.0.0-SNAPSHOT:test +[INFO] +- io.micrometer:micrometer-test:jar:2.0.0-SNAPSHOT:test +[INFO] | +- ru.lanwen.wiremock:wiremock-junit5:jar:1.3.1:test +[INFO] | \- com.github.tomakehurst:wiremock-jre8-standalone:jar:2.33.1:test +[INFO] +- io.micrometer:micrometer-tracing-bridge-brave:jar:1.0.0-SNAPSHOT:test +[INFO] +- io.zipkin.brave:brave:jar:5.13.2:test +[INFO] +- io.zipkin.brave:brave-context-slf4j:jar:5.13.2:test +[INFO] +- io.zipkin.brave:brave-instrumentation-http:jar:5.13.2:test +[INFO] +- io.zipkin.brave:brave-tests:jar:5.13.2:test +[INFO] | \- junit:junit:jar:4.13.2:test +[INFO] | \- org.hamcrest:hamcrest-core:jar:2.2:test +[INFO] +- io.zipkin.aws:brave-propagation-aws:jar:0.23.2:test +[INFO] +- io.zipkin.reporter2:zipkin-reporter-brave:jar:2.16.1:test +[INFO] +- io.micrometer:micrometer-tracing-bridge-otel:jar:1.0.0-SNAPSHOT:test +[INFO] | +- io.opentelemetry:opentelemetry-api:jar:1.13.0:test +[INFO] | | \- io.opentelemetry:opentelemetry-context:jar:1.13.0:test +[INFO] | +- io.opentelemetry:opentelemetry-extension-aws:jar:1.13.0:test +[INFO] | +- io.opentelemetry:opentelemetry-semconv:jar:1.13.0-alpha:test +[INFO] | +- io.opentelemetry:opentelemetry-sdk-common:jar:1.13.0:test +[INFO] | \- io.opentelemetry:opentelemetry-sdk:jar:1.13.0:test +[INFO] | +- io.opentelemetry:opentelemetry-sdk-metrics:jar:1.13.0-alpha:test +[INFO] | \- io.opentelemetry:opentelemetry-sdk-logs:jar:1.13.0-alpha:test +[INFO] +- io.opentelemetry:opentelemetry-exporter-zipkin:jar:1.13.0:test +[INFO] | \- io.zipkin.reporter2:zipkin-sender-okhttp3:jar:2.16.1:test +[INFO] | \- com.squareup.okhttp3:okhttp:jar:4.9.3:test +[INFO] | \- com.squareup.okio:okio:jar:2.8.0:test +[INFO] +- io.opentelemetry:opentelemetry-sdk-trace:jar:1.13.0:test +[INFO] +- io.opentelemetry:opentelemetry-extension-trace-propagators:jar:1.13.0:test +[INFO] +- io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:jar:1.12.1-alpha:test +[INFO] +- io.zipkin.zipkin2:zipkin:jar:2.23.0:test +[INFO] +- io.zipkin.reporter2:zipkin-reporter:jar:2.16.1:test +[INFO] +- io.zipkin.reporter2:zipkin-sender-urlconnection:jar:2.16.1:test +[INFO] +- io.zipkin.reporter2:zipkin-sender-kafka:jar:2.16.1:test +[INFO] +- io.zipkin.reporter2:zipkin-sender-activemq-client:jar:2.16.1:test +[INFO] +- io.zipkin.reporter2:zipkin-sender-amqp-client:jar:2.16.1:test +[INFO] +- com.wavefront:wavefront-sdk-java:jar:3.0.0:test +[INFO] | +- com.google.code.findbugs:jsr305:jar:3.0.2:test +[INFO] | +- com.tdunning:t-digest:jar:3.2:test +[INFO] | \- com.google.guava:guava:jar:31.0.1-jre:test +[INFO] | +- com.google.guava:failureaccess:jar:1.0.1:test +[INFO] | +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:test +[INFO] | +- org.checkerframework:checker-qual:jar:3.12.0:test +[INFO] | +- com.google.errorprone:error_prone_annotations:jar:2.7.1:test +[INFO] | \- com.google.j2objc:j2objc-annotations:jar:1.3:test +[INFO] \- com.wavefront:wavefront-internal-reporter-java:jar:1.7.10:test +[INFO] \- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.13.2:test +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 1.157 s +[INFO] Finished at: 2022-05-03T19:59:07+02:00 +[INFO] ------------------------------------------------------------------------ diff --git a/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/config/SmartCompositeMessageConverter.java b/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/config/SmartCompositeMessageConverter.java index 5b62325f1..32524a8f7 100644 --- a/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/config/SmartCompositeMessageConverter.java +++ b/spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/config/SmartCompositeMessageConverter.java @@ -19,6 +19,9 @@ package org.springframework.cloud.function.context.config; import java.util.Collection; import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHeaders; @@ -37,6 +40,8 @@ import org.springframework.util.StringUtils; */ public class SmartCompositeMessageConverter extends CompositeMessageConverter { + private Log logger = LogFactory.getLog(this.getClass()); + public SmartCompositeMessageConverter(Collection converters) { super(converters); } @@ -48,9 +53,16 @@ public class SmartCompositeMessageConverter extends CompositeMessageConverter { if (!(message.getPayload() instanceof byte[]) && targetClass.isInstance(message.getPayload()) && !(message.getPayload() instanceof Collection)) { return message.getPayload(); } - Object result = converter.fromMessage(message, targetClass); - if (result != null) { - return result; + try { + Object result = converter.fromMessage(message, targetClass); + if (result != null) { + return result; + } + } + catch (Exception e) { + if (logger.isDebugEnabled()) { + logger.debug("Failure during type conversion by " + converter + ". Will try the next converter.", e); + } } } return null;