|
1 | 1 | /* |
2 | | - * Copyright 2002-2019 the original author or authors. |
| 2 | + * Copyright 2002-2020 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
20 | 20 | import java.io.UncheckedIOException; |
21 | 21 | import java.util.Arrays; |
22 | 22 |
|
23 | | -import org.apache.commons.logging.Log; |
24 | | -import org.apache.commons.logging.LogFactory; |
25 | 23 | import org.xml.sax.SAXParseException; |
26 | 24 |
|
27 | 25 | import org.springframework.core.io.Resource; |
| 26 | +import org.springframework.core.log.LogAccessor; |
28 | 27 | import org.springframework.integration.MessageRejectedException; |
29 | 28 | import org.springframework.integration.core.MessageSelector; |
30 | 29 | import org.springframework.integration.xml.AggregatedXmlMessageValidationException; |
@@ -65,7 +64,7 @@ public String getUrl() { |
65 | 64 |
|
66 | 65 | } |
67 | 66 |
|
68 | | - private static final Log LOGGER = LogFactory.getLog(XmlValidatingMessageSelector.class); |
| 67 | + private static final LogAccessor LOGGER = new LogAccessor(XmlValidatingMessageSelector.class); |
69 | 68 |
|
70 | 69 | private final XmlValidator xmlValidator; |
71 | 70 |
|
@@ -98,9 +97,9 @@ public XmlValidatingMessageSelector(XmlValidator xmlValidator) { |
98 | 97 |
|
99 | 98 | public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException { |
100 | 99 | this(schema, |
101 | | - StringUtils.isEmpty(schemaType) |
102 | | - ? null |
103 | | - : SchemaType.valueOf(schemaType.toUpperCase().replaceFirst("-", "_"))); |
| 100 | + StringUtils.hasText(schemaType) |
| 101 | + ? SchemaType.valueOf(schemaType.toUpperCase().replaceFirst("-", "_")) |
| 102 | + : null); |
104 | 103 | } |
105 | 104 |
|
106 | 105 |
|
@@ -133,9 +132,9 @@ public boolean accept(Message<?> message) { |
133 | 132 | throw new MessageRejectedException(message, exceptionMessage, |
134 | 133 | new AggregatedXmlMessageValidationException(Arrays.asList(validationExceptions))); |
135 | 134 | } |
136 | | - else if (LOGGER.isInfoEnabled()) { |
137 | | - LOGGER.info(exceptionMessage, |
138 | | - new AggregatedXmlMessageValidationException(Arrays.asList(validationExceptions))); |
| 135 | + else { |
| 136 | + LOGGER.info(new AggregatedXmlMessageValidationException(Arrays.asList(validationExceptions)), |
| 137 | + exceptionMessage); |
139 | 138 | } |
140 | 139 | } |
141 | 140 | return validationSuccess; |
|
0 commit comments