Skip to content

Commit ac6a098

Browse files
committed
Fix deprecations from Spring's StringUtils
* Use `LogAccessor` in the `XmlValidatingMessageSelector`
1 parent 0a2a82a commit ac6a098

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/ReactiveRedisStreamMessageProducer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public String getComponentType() {
169169
protected void onInit() {
170170
super.onInit();
171171
this.streamReceiver = StreamReceiver.create(this.reactiveConnectionFactory, this.streamReceiverOptions);
172-
if (StringUtils.hasText(this.consumerName) && StringUtils.isEmpty(this.consumerGroup)) {
172+
if (StringUtils.hasText(this.consumerName) && !StringUtils.hasText(this.consumerGroup)) {
173173
this.consumerGroup = getBeanName();
174174
}
175175
ReactiveRedisTemplate<String, ?> reactiveRedisTemplate =
@@ -185,7 +185,7 @@ protected void doStart() {
185185

186186
Flux<? extends Record<String, ?>> events;
187187

188-
if (StringUtils.isEmpty(this.consumerName)) {
188+
if (!StringUtils.hasText(this.consumerName)) {
189189
events = this.streamReceiver.receive(offset);
190190
}
191191
else {

spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,11 +20,10 @@
2020
import java.io.UncheckedIOException;
2121
import java.util.Arrays;
2222

23-
import org.apache.commons.logging.Log;
24-
import org.apache.commons.logging.LogFactory;
2523
import org.xml.sax.SAXParseException;
2624

2725
import org.springframework.core.io.Resource;
26+
import org.springframework.core.log.LogAccessor;
2827
import org.springframework.integration.MessageRejectedException;
2928
import org.springframework.integration.core.MessageSelector;
3029
import org.springframework.integration.xml.AggregatedXmlMessageValidationException;
@@ -65,7 +64,7 @@ public String getUrl() {
6564

6665
}
6766

68-
private static final Log LOGGER = LogFactory.getLog(XmlValidatingMessageSelector.class);
67+
private static final LogAccessor LOGGER = new LogAccessor(XmlValidatingMessageSelector.class);
6968

7069
private final XmlValidator xmlValidator;
7170

@@ -98,9 +97,9 @@ public XmlValidatingMessageSelector(XmlValidator xmlValidator) {
9897

9998
public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException {
10099
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);
104103
}
105104

106105

@@ -133,9 +132,9 @@ public boolean accept(Message<?> message) {
133132
throw new MessageRejectedException(message, exceptionMessage,
134133
new AggregatedXmlMessageValidationException(Arrays.asList(validationExceptions)));
135134
}
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);
139138
}
140139
}
141140
return validationSuccess;

0 commit comments

Comments
 (0)