Skip to content

Commit c264e12

Browse files
committed
Fix new Sonar smells
1 parent dc15910 commit c264e12

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

spring-integration-core/src/main/java/org/springframework/integration/aop/AbstractMessageSourceAdvice.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616

1717
package org.springframework.integration.aop;
1818

19-
import org.springframework.integration.core.MessageSource;
20-
2119
/**
22-
* Advice for a {@link MessageSource#receive()} method to decide whether a poll
20+
* Advice for a {@link org.springframework.integration.core.MessageSource#receive()} method to decide whether a poll
2321
* should be ignored and/or take action after the receive.
2422
*
2523
* @author Gary Russell

spring-integration-core/src/main/java/org/springframework/integration/gateway/AnnotationGatewayProxyFactoryBean.java

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.concurrent.Executor;
2222
import java.util.stream.Collectors;
2323

24+
import org.springframework.beans.factory.BeanFactory;
2425
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
2526
import org.springframework.core.annotation.AnnotatedElementUtils;
2627
import org.springframework.core.annotation.AnnotationAttributes;
@@ -70,11 +71,7 @@ public AnnotationGatewayProxyFactoryBean(Class<?> serviceInterface) {
7071

7172
@Override
7273
protected void onInit() {
73-
ConfigurableListableBeanFactory beanFactory = (ConfigurableListableBeanFactory) getBeanFactory();
74-
75-
if (getGlobalMethodMetadata() == null) {
76-
populateGatewayMethodMetadata();
77-
}
74+
populateGatewayMethodMetadataIfAny();
7875

7976
String defaultRequestTimeout = resolveAttribute("defaultRequestTimeout");
8077
String defaultReplyTimeout = resolveAttribute("defaultReplyTimeout");
@@ -96,23 +93,20 @@ protected void onInit() {
9693
defaultReplyTimeout,
9794
value -> setDefaultReplyTimeout(Long.parseLong(value)));
9895

99-
if (!isAsyncExecutorExplicitlySet()) {
100-
String asyncExecutor = resolveAttribute("asyncExecutor");
101-
if (asyncExecutor == null || AnnotationConstants.NULL.equals(asyncExecutor)) {
102-
setAsyncExecutor(null);
103-
}
104-
else if (StringUtils.hasText(asyncExecutor)) {
105-
setAsyncExecutor(beanFactory.getBean(asyncExecutor, Executor.class));
106-
}
107-
}
96+
populateAsyncExecutorIfAny();
97+
10898
boolean proxyDefaultMethods = this.gatewayAttributes.getBoolean("proxyDefaultMethods");
10999
if (proxyDefaultMethods) {
110100
setProxyDefaultMethods(proxyDefaultMethods);
111101
}
112102
super.onInit();
113103
}
114104

115-
private void populateGatewayMethodMetadata() {
105+
private void populateGatewayMethodMetadataIfAny() {
106+
if (getGlobalMethodMetadata() != null) {
107+
return;
108+
}
109+
116110
ConfigurableListableBeanFactory beanFactory = (ConfigurableListableBeanFactory) getBeanFactory();
117111

118112
String defaultPayloadExpression = resolveAttribute("defaultPayloadExpression");
@@ -169,6 +163,19 @@ private void populateGatewayMethodMetadata() {
169163
}
170164
}
171165

166+
private void populateAsyncExecutorIfAny() {
167+
BeanFactory beanFactory = getBeanFactory();
168+
if (!isAsyncExecutorExplicitlySet()) {
169+
String asyncExecutor = resolveAttribute("asyncExecutor");
170+
if (asyncExecutor == null || AnnotationConstants.NULL.equals(asyncExecutor)) {
171+
setAsyncExecutor(null);
172+
}
173+
else if (StringUtils.hasText(asyncExecutor)) {
174+
setAsyncExecutor(beanFactory.getBean(asyncExecutor, Executor.class));
175+
}
176+
}
177+
}
178+
172179
@Nullable
173180
private String resolveAttribute(String attributeName) {
174181
ConfigurableListableBeanFactory beanFactory = (ConfigurableListableBeanFactory) getBeanFactory();

spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/ClientRSocketConnector.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.springframework.util.Assert;
2727
import org.springframework.util.MimeType;
2828

29-
import io.rsocket.core.RSocketConnector;
3029
import io.rsocket.transport.ClientTransport;
3130
import io.rsocket.transport.netty.client.TcpClientTransport;
3231
import io.rsocket.transport.netty.client.WebsocketClientTransport;
@@ -118,9 +117,9 @@ public void setFactoryConfigurer(
118117
* target {@link RSocketRequester} to populate a reference to an internal
119118
* {@link IntegrationRSocketMessageHandler#responder()}.
120119
* This overrides possible external
121-
* {@link RSocketConnector#acceptor(io.rsocket.SocketAcceptor)}
120+
* {@link io.rsocket.core.RSocketConnector#acceptor(io.rsocket.SocketAcceptor)}
122121
* @param connectorConfigurer the {@link RSocketConnectorConfigurer} to
123-
* configure the {@link RSocketConnector}.
122+
* configure the {@link io.rsocket.core.RSocketConnector}.
124123
* @since 5.2.6
125124
* @see RSocketRequester.Builder#rsocketConnector(RSocketConnectorConfigurer)
126125
*/

spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/ServerRSocketConnector.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.springframework.util.Assert;
3232
import org.springframework.util.MimeType;
3333

34-
import io.rsocket.core.RSocketConnector;
3534
import io.rsocket.core.RSocketServer;
3635
import io.rsocket.transport.ServerTransport;
3736
import io.rsocket.transport.netty.server.CloseableChannel;
@@ -48,7 +47,7 @@
4847
*
4948
* @since 5.2
5049
*
51-
* @see RSocketConnector
50+
* @see io.rsocket.core.RSocketConnector
5251
*/
5352
public class ServerRSocketConnector extends AbstractRSocketConnector implements ApplicationEventPublisherAware {
5453

0 commit comments

Comments
 (0)