Fix more issues from Sonar report

This commit is contained in:
Artem Bilan
2022-11-03 12:44:26 -04:00
parent 0b9bab313b
commit 5f1c0c17de
13 changed files with 60 additions and 50 deletions

View File

@@ -305,14 +305,13 @@ public class DefaultSftpSessionFactory implements SessionFactory<SftpClient.DirE
initClient();
Duration verifyTimeout = this.timeout != null ? Duration.ofMillis(this.timeout) : null;
HostConfigEntry hostConfig = this.hostConfig;
if (hostConfig == null) {
hostConfig =
new HostConfigEntry(SshdSocketAddress.isIPv6Address(this.host) ? "" : this.host, this.host,
HostConfigEntry config = this.hostConfig;
if (config == null) {
config = new HostConfigEntry(SshdSocketAddress.isIPv6Address(this.host) ? "" : this.host, this.host,
this.port, this.user);
}
ClientSession clientSession =
this.sshClient.connect(hostConfig)
this.sshClient.connect(config)
.verify(verifyTimeout)
.getSession();