use of org.springframework.integration.xml.AggregatedXmlMessageValidationException in project spring-integration by spring-projects.
the class XmlValidatingMessageSelector method accept.
@Override
public boolean accept(Message<?> message) {
SAXParseException[] validationExceptions = null;
try {
validationExceptions = this.xmlValidator.validate(this.converter.convertToSource(message.getPayload()));
} catch (Exception e) {
throw new MessageHandlingException(message, e);
}
boolean validationSuccess = ObjectUtils.isEmpty(validationExceptions);
if (!validationSuccess) {
if (this.throwExceptionOnRejection) {
throw new MessageRejectedException(message, "Message was rejected due to XML Validation errors", new AggregatedXmlMessageValidationException(Arrays.<Throwable>asList(validationExceptions)));
}
this.logger.debug("Message was rejected due to XML Validation errors");
}
return validationSuccess;
}
Aggregations