INT-1519, INT-957, INT-1515, Added support for propagating XML Validation exceptions with MessageRejectedException, added support for 'xml-validator' attribute, change XmlValidatingMessageSelector to be bootstrapped with either Resource/Schema or XmlValidator
This commit is contained in:
@@ -100,14 +100,24 @@ public class MessageFilter extends AbstractReplyProducingMessageHandler {
|
||||
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> message) {
|
||||
if (this.selector.accept(message)) {
|
||||
return message;
|
||||
}
|
||||
Throwable filterException = null;
|
||||
try {
|
||||
if (this.selector.accept(message)) {
|
||||
return message;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
filterException = e;
|
||||
}
|
||||
if (this.discardChannel != null) {
|
||||
this.getMessagingTemplate().send(this.discardChannel, message);
|
||||
}
|
||||
if (this.throwExceptionOnRejection) {
|
||||
throw new MessageRejectedException(message, "MessageFilter '" + this.getComponentName() + "' rejected Message");
|
||||
if (filterException != null){
|
||||
throw new MessageRejectedException(message, "MessageFilter '" + this.getComponentName() + "' rejected Message", filterException);
|
||||
}
|
||||
else {
|
||||
throw new MessageRejectedException(message, "MessageFilter '" + this.getComponentName() + "' rejected Message");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user