Example usage for org.springframework.integration.xml AggregatedXmlMessageValidationException AggregatedXmlMessageValidationException

List of usage examples for org.springframework.integration.xml AggregatedXmlMessageValidationException AggregatedXmlMessageValidationException

Introduction

In this page you can find the example usage for org.springframework.integration.xml AggregatedXmlMessageValidationException AggregatedXmlMessageValidationException.

Prototype

public AggregatedXmlMessageValidationException(List<Throwable> exceptions) 

Source Link

Usage

From source file:org.springframework.integration.xml.selector.XmlValidatingMessageSelector.java

@SuppressWarnings("unchecked")
public boolean accept(Message<?> message) {
    SAXParseException[] validationExceptions = null;
    try {//from w  ww  .  ja  v  a 2s. c  o  m
        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(
                            CollectionUtils.arrayToList(validationExceptions)));
        }
        if (logger.isDebugEnabled()) {
            logger.debug("Message was rejected due to XML Validation errors");
        }
    }
    return validationSuccess;
}