Update to Spring 4 Build Snapshot
- IdGenerator package change - Generics added to CollectionUtils.arrayToList()
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,13 +23,13 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.messaging.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;
|
||||
import org.springframework.integration.xml.XmlPayloadConverter;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -39,6 +39,7 @@ import org.springframework.xml.validation.XmlValidatorFactory;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
public class XmlValidatingMessageSelector implements MessageSelector {
|
||||
@@ -62,7 +63,7 @@ public class XmlValidatingMessageSelector implements MessageSelector {
|
||||
* the provided 'schema' location {@link Resource} and 'schemaType'. The valid options for schema
|
||||
* type are {@link XmlValidatorFactory#SCHEMA_W3C_XML} or {@link XmlValidatorFactory#SCHEMA_RELAX_NG}.
|
||||
* If no 'schemaType' is provided it will default to {@link XmlValidatorFactory#SCHEMA_W3C_XML};
|
||||
*
|
||||
*
|
||||
* @throws IOException if the XmlValidatorFactory fails to create a validator
|
||||
*/
|
||||
public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException {
|
||||
@@ -86,7 +87,6 @@ public class XmlValidatingMessageSelector implements MessageSelector {
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean accept(Message<?> message) {
|
||||
SAXParseException[] validationExceptions = null;
|
||||
try {
|
||||
@@ -98,8 +98,9 @@ public class XmlValidatingMessageSelector implements MessageSelector {
|
||||
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)));
|
||||
throw new MessageRejectedException(message, "Message was rejected due to XML Validation errors",
|
||||
new AggregatedXmlMessageValidationException(
|
||||
CollectionUtils.<Throwable> arrayToList(validationExceptions)));
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Message was rejected due to XML Validation errors");
|
||||
|
||||
Reference in New Issue
Block a user