javaduke commented on code in PR #8023:
URL: https://github.com/apache/camel/pull/8023#discussion_r928873357


##########
components/camel-datasonnet/src/main/java/org/apache/camel/language/datasonnet/DatasonnetExpression.java:
##########
@@ -114,7 +114,11 @@ private Document<?> doEvaluate(Exchange exchange) {
         }
 
         Document<?> body;
-        if (exchange.getMessage().getBody() instanceof Document) {
+
+        if (exchange.getMessage().getBody() == null || 
"".equals(MessageHelper.extractBodyAsString(exchange.getMessage()))) {

Review Comment:
   No, if it's an empty Document, it's a different story (a Document cannot 
really be empty). Datasonnet doesn't like empty inputs, and I'm really just 
trying to deal with the situation where message body is not used in mapping but 
Datasonnet expects it anyway. If an input is an XML document and the mapping 
expects something else, there should be a legitimate error thrown.
   So I really just need to make sure that if it's null or an empty string, we 
force the empty string with java object mime type, to avoid an error. 



-- 
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-unsubscr...@camel.apache.org

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

Reply via email to