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


##########
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:
   Ah yeah do you need to do this even if there is a Document object and its 
empty? Because if you convert that to a string you do an xml dump which would 
not be empty, it will have <xml ...> something as output.
   
   The extractBody ... method deals with stream caching so that is good. It may 
not be as much overkill, just that the message body can be InputStream, byte[], 
XML Document and many other things, and in Java everything can be converted to 
a String via Object.toString so you would essentailly always get some output.
   



-- 
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