Fix Sonar issues

This commit is contained in:
Gary Russell
2019-07-31 09:40:54 -04:00
parent 884db2c609
commit f7fc3360cd
5 changed files with 31 additions and 17 deletions

View File

@@ -264,18 +264,25 @@ public abstract class AbstractMappingMessageRouter extends AbstractMessageRouter
mapped = true;
}
if (channelName != null) {
if (this.prefix != null) {
channelName = this.prefix + channelName;
}
if (this.suffix != null) {
channelName = channelName + this.suffix;
}
MessageChannel channel = resolveChannelForName(channelName, message);
if (channel != null) {
channels.add(channel);
if (!mapped && this.dynamicChannels.get(channelName) == null) {
this.dynamicChannels.put(channelName, channel);
}
addChannel(channels, message, channelName, mapped);
}
}
private void addChannel(Collection<MessageChannel> channels, Message<?> message, String channelNameArg,
boolean mapped) {
String channelName = channelNameArg;
if (this.prefix != null) {
channelName = this.prefix + channelName;
}
if (this.suffix != null) {
channelName = channelName + this.suffix;
}
MessageChannel channel = resolveChannelForName(channelName, message);
if (channel != null) {
channels.add(channel);
if (!mapped && this.dynamicChannels.get(channelName) == null) {
this.dynamicChannels.put(channelName, channel);
}
}
}

View File

@@ -19,6 +19,8 @@ package org.springframework.integration.sftp.server;
import java.nio.file.Path;
import java.util.Map;
import org.springframework.lang.Nullable;
/**
* An event emitted when a directory is created.
*
@@ -30,7 +32,7 @@ public class DirectoryCreatedEvent extends ApacheMinaSftpEvent {
private static final long serialVersionUID = 1L;
private final Path path;
private transient Path path;
private final Map<String, ?> attrs;
@@ -40,6 +42,7 @@ public class DirectoryCreatedEvent extends ApacheMinaSftpEvent {
this.attrs = attrs;
}
@Nullable
public Path getPath() {
return this.path;
}

View File

@@ -33,7 +33,7 @@ public class FileWrittenEvent extends ApacheMinaSftpEvent {
private final String remoteHandle;
private final Path file;
private transient Path file;
private final int dataLen;
@@ -48,6 +48,7 @@ public class FileWrittenEvent extends ApacheMinaSftpEvent {
return this.remoteHandle;
}
@Nullable
public Path getFile() {
return this.file;
}

View File

@@ -31,9 +31,9 @@ public class PathMovedEvent extends ApacheMinaSftpEvent {
private static final long serialVersionUID = 1L;
private final Path srcPath;
private transient Path srcPath;
private final Path dstPath;
private transient Path dstPath;
public PathMovedEvent(Object source, Path srcPath, Path dstPath, @Nullable Throwable thrown) {
super(source, thrown);
@@ -41,10 +41,12 @@ public class PathMovedEvent extends ApacheMinaSftpEvent {
this.dstPath = dstPath;
}
@Nullable
public Path getSrcPath() {
return this.srcPath;
}
@Nullable
public Path getDstPath() {
return this.dstPath;
}

View File

@@ -31,7 +31,7 @@ public class PathRemovedEvent extends ApacheMinaSftpEvent {
private static final long serialVersionUID = 1L;
private final Path path;
private transient Path path;
private final boolean isDirectory;
@@ -41,6 +41,7 @@ public class PathRemovedEvent extends ApacheMinaSftpEvent {
this.isDirectory = isDirectory;
}
@Nullable
public Path getPath() {
return this.path;
}