Skip to content

Commit f7fc336

Browse files
committed
Fix Sonar issues
1 parent 884db2c commit f7fc336

File tree

5 files changed

+31
-17
lines changed

5 files changed

+31
-17
lines changed

spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java

+19-12
Original file line numberDiff line numberDiff line change
@@ -264,18 +264,25 @@ private void addChannelFromString(Collection<MessageChannel> channels, String ch
264264
mapped = true;
265265
}
266266
if (channelName != null) {
267-
if (this.prefix != null) {
268-
channelName = this.prefix + channelName;
269-
}
270-
if (this.suffix != null) {
271-
channelName = channelName + this.suffix;
272-
}
273-
MessageChannel channel = resolveChannelForName(channelName, message);
274-
if (channel != null) {
275-
channels.add(channel);
276-
if (!mapped && this.dynamicChannels.get(channelName) == null) {
277-
this.dynamicChannels.put(channelName, channel);
278-
}
267+
addChannel(channels, message, channelName, mapped);
268+
}
269+
}
270+
271+
private void addChannel(Collection<MessageChannel> channels, Message<?> message, String channelNameArg,
272+
boolean mapped) {
273+
274+
String channelName = channelNameArg;
275+
if (this.prefix != null) {
276+
channelName = this.prefix + channelName;
277+
}
278+
if (this.suffix != null) {
279+
channelName = channelName + this.suffix;
280+
}
281+
MessageChannel channel = resolveChannelForName(channelName, message);
282+
if (channel != null) {
283+
channels.add(channel);
284+
if (!mapped && this.dynamicChannels.get(channelName) == null) {
285+
this.dynamicChannels.put(channelName, channel);
279286
}
280287
}
281288
}

spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/DirectoryCreatedEvent.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.nio.file.Path;
2020
import java.util.Map;
2121

22+
import org.springframework.lang.Nullable;
23+
2224
/**
2325
* An event emitted when a directory is created.
2426
*
@@ -30,7 +32,7 @@ public class DirectoryCreatedEvent extends ApacheMinaSftpEvent {
3032

3133
private static final long serialVersionUID = 1L;
3234

33-
private final Path path;
35+
private transient Path path;
3436

3537
private final Map<String, ?> attrs;
3638

@@ -40,6 +42,7 @@ public DirectoryCreatedEvent(Object source, Path path, Map<String, ?> attrs) {
4042
this.attrs = attrs;
4143
}
4244

45+
@Nullable
4346
public Path getPath() {
4447
return this.path;
4548
}

spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/FileWrittenEvent.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class FileWrittenEvent extends ApacheMinaSftpEvent {
3333

3434
private final String remoteHandle;
3535

36-
private final Path file;
36+
private transient Path file;
3737

3838
private final int dataLen;
3939

@@ -48,6 +48,7 @@ public String getRemoteHandle() {
4848
return this.remoteHandle;
4949
}
5050

51+
@Nullable
5152
public Path getFile() {
5253
return this.file;
5354
}

spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/PathMovedEvent.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,22 @@ public class PathMovedEvent extends ApacheMinaSftpEvent {
3131

3232
private static final long serialVersionUID = 1L;
3333

34-
private final Path srcPath;
34+
private transient Path srcPath;
3535

36-
private final Path dstPath;
36+
private transient Path dstPath;
3737

3838
public PathMovedEvent(Object source, Path srcPath, Path dstPath, @Nullable Throwable thrown) {
3939
super(source, thrown);
4040
this.srcPath = srcPath;
4141
this.dstPath = dstPath;
4242
}
4343

44+
@Nullable
4445
public Path getSrcPath() {
4546
return this.srcPath;
4647
}
4748

49+
@Nullable
4850
public Path getDstPath() {
4951
return this.dstPath;
5052
}

spring-integration-sftp/src/main/java/org/springframework/integration/sftp/server/PathRemovedEvent.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class PathRemovedEvent extends ApacheMinaSftpEvent {
3131

3232
private static final long serialVersionUID = 1L;
3333

34-
private final Path path;
34+
private transient Path path;
3535

3636
private final boolean isDirectory;
3737

@@ -41,6 +41,7 @@ public PathRemovedEvent(Object source, Path path, boolean isDirectory, @Nullable
4141
this.isDirectory = isDirectory;
4242
}
4343

44+
@Nullable
4445
public Path getPath() {
4546
return this.path;
4647
}

0 commit comments

Comments
 (0)