Fix deprecations from Spring's StringUtils

* Use `LogAccessor` in the `XmlValidatingMessageSelector`
This commit is contained in:
Artem Bilan
2020-10-28 16:33:51 -04:00
parent 0a2a82a2f3
commit ac6a0982e5
2 changed files with 11 additions and 12 deletions

View File

@@ -169,7 +169,7 @@ public class ReactiveRedisStreamMessageProducer extends MessageProducerSupport {
protected void onInit() {
super.onInit();
this.streamReceiver = StreamReceiver.create(this.reactiveConnectionFactory, this.streamReceiverOptions);
if (StringUtils.hasText(this.consumerName) && StringUtils.isEmpty(this.consumerGroup)) {
if (StringUtils.hasText(this.consumerName) && !StringUtils.hasText(this.consumerGroup)) {
this.consumerGroup = getBeanName();
}
ReactiveRedisTemplate<String, ?> reactiveRedisTemplate =
@@ -185,7 +185,7 @@ public class ReactiveRedisStreamMessageProducer extends MessageProducerSupport {
Flux<? extends Record<String, ?>> events;
if (StringUtils.isEmpty(this.consumerName)) {
if (!StringUtils.hasText(this.consumerName)) {
events = this.streamReceiver.receive(offset);
}
else {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -20,11 +20,10 @@ import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Arrays;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.xml.sax.SAXParseException;
import org.springframework.core.io.Resource;
import org.springframework.core.log.LogAccessor;
import org.springframework.integration.MessageRejectedException;
import org.springframework.integration.core.MessageSelector;
import org.springframework.integration.xml.AggregatedXmlMessageValidationException;
@@ -65,7 +64,7 @@ public class XmlValidatingMessageSelector implements MessageSelector {
}
private static final Log LOGGER = LogFactory.getLog(XmlValidatingMessageSelector.class);
private static final LogAccessor LOGGER = new LogAccessor(XmlValidatingMessageSelector.class);
private final XmlValidator xmlValidator;
@@ -98,9 +97,9 @@ public class XmlValidatingMessageSelector implements MessageSelector {
public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException {
this(schema,
StringUtils.isEmpty(schemaType)
? null
: SchemaType.valueOf(schemaType.toUpperCase().replaceFirst("-", "_")));
StringUtils.hasText(schemaType)
? SchemaType.valueOf(schemaType.toUpperCase().replaceFirst("-", "_"))
: null);
}
@@ -133,9 +132,9 @@ public class XmlValidatingMessageSelector implements MessageSelector {
throw new MessageRejectedException(message, exceptionMessage,
new AggregatedXmlMessageValidationException(Arrays.asList(validationExceptions)));
}
else if (LOGGER.isInfoEnabled()) {
LOGGER.info(exceptionMessage,
new AggregatedXmlMessageValidationException(Arrays.asList(validationExceptions)));
else {
LOGGER.info(new AggregatedXmlMessageValidationException(Arrays.asList(validationExceptions)),
exceptionMessage);
}
}
return validationSuccess;