You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/03/01 17:51:47 UTC

[GitHub] [camel] essobedo commented on a change in pull request #7073: CAMEL-17720: camel-jackson - Add option to allow jackson to support null body

essobedo commented on a change in pull request #7073:
URL: https://github.com/apache/camel/pull/7073#discussion_r817008481



##########
File path: core/camel-api/src/main/java/org/apache/camel/spi/DataFormat.java
##########
@@ -54,4 +54,13 @@
      * @throws Exception can be thrown
      */
     Object unmarshal(Exchange exchange, InputStream stream) throws Exception;
+
+    /**
+     * Indicates whether {@code null} is allowed as value of a body to unmarshall.
+     *
+     * @return {@code true} if {@code null} is allowed, {@code false} otherwise.
+     */
+    default boolean allowNullBody() {

Review comment:
       That's a good remark, actually, the failure doesn't happen in the Jackson `DataFormat` itself but in the `UnmarshalProcessor`.  Indeed, The failure is due to the fact that it cannot find a converter to convert a `null` value into an `InputStream` which occurs when calling `in.getMandatoryBody(InputStream.class)`. That is why I had to manage it at a higher level, moreover @davsclaus proposed in the same ticket to eventually have it for all the existing DataFormat which could give more sense to this approach. Do you see a better/simpler approach? If I need to apply the same logic to the other DataFormats, I had better to have the best approach.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org