On 7 Sep 2005, at 15:22, Cyan Hamster wrote:
Hi,
I am trying out ServiceMix (1.0.1) and when using the Drools
routing component to route messages with attachments I discovered
that the CopyTransformer used in DroolsComponent (inherited from
ComponentSupport) does not copy attachments between the "in" and
"out" messages. See code below.
Is there any reason for this or is it a bug?
Its a bug; apologies for that.
Additionaly, the transformer property of ComponentSupport is named
tranformer (sic!), with access methods getTranformer and
setTranformer. I assume you are aware of this, but it doesn't hurt
to mention it, I hope.
Thanks for the heads up - we fixed that a little while ago in CVS
HEAD - we should do a release fairly soon to ensure folks are not
dependent on badly named methods :)
From CopyTransformer:
public boolean transform(MessageExchange exchange,
NormalizedMessage from, NormalizedMessage to) throws
MessagingException {
copyProperties(from, to);
Source content = from.getContent();
if (content instanceof StreamSource && !(content instanceof
StringSource)) {
// lets avoid stream open exceptions by using a
temporary format
try {
content = transformer.toDOMSource(from);
}
catch (TransformerException e) {
throw new MessagingException(e);
}
}
to.setContent(content);
return true;
}
Good catch! :)
I've patched this code for issue SM-64 which is now resolved in CVS HEAD
http://jira.logicblaze.com/jira/browse/SM-64
James
-------
http://radio.weblogs.com/0112098/