INT-957, polishing, also going back to throwing MessageRejectionException from XmlValidatingMessageSelector

This commit is contained in:
Oleg Zhurakousky
2010-10-14 18:26:06 -04:00
parent 80c9b89851
commit 654ded6898
2 changed files with 7 additions and 15 deletions

View File

@@ -19,6 +19,7 @@ package org.springframework.integration.xml.selector;
import org.springframework.core.io.Resource;
import org.springframework.integration.Message;
import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.MessageRejectedException;
import org.springframework.integration.core.MessageSelector;
import org.springframework.integration.xml.AggregatedXmlMessageValidationException;
import org.springframework.integration.xml.DefaultXmlPayloadConverter;
@@ -76,7 +77,8 @@ public class XmlValidatingMessageSelector implements MessageSelector {
}
boolean validationSuccess = ObjectUtils.isEmpty(validationExceptions);
if (!validationSuccess && throwExceptionOnRejection){
throw new AggregatedXmlMessageValidationException(CollectionUtils.arrayToList(validationExceptions));
throw new MessageRejectedException(message, "Message was rejected due to XML Validation errors",
new AggregatedXmlMessageValidationException(CollectionUtils.arrayToList(validationExceptions)));
}
return validationSuccess;
}