Skip to content

Commit

Permalink
SWITCHYARD-2979 Transformer invoked from getContent() should also han…
Browse files Browse the repository at this point in the history
…dle Message parameter
  • Loading branch information
cunningt committed Feb 9, 2017
1 parent dca5dd9 commit 2c9d584
Showing 1 changed file with 12 additions and 1 deletion.
Expand Up @@ -108,7 +108,18 @@ protected <T> T getBody(Class<T> type, Object body) {
+ "', class=" + transformer.getClass()
+ "'] to the body '" + body + "'");
}
Object transformedContent = transformer.transform(body);

Object transformedContent = null;
if (Message.class.isAssignableFrom(transformer.getFromType())) {
// A returned object just indicates that the transformation took place.
transformer.transform(this);
transformedContent = getBody();
} else {
// A returned object indicates that the transformation took place and is
// used as the new Message payload.
transformedContent = transformer.transform(body);
}

if (transformedContent == null) {
throw BusMessages.MESSAGES.transformerReturnedNull(body.getClass().getName(), type.getName(), transformer.getClass().getName());
}
Expand Down

0 comments on commit 2c9d584

Please sign in to comment.