From 1b892fc7a4d217dbe00aef77b4997e875e7d5805 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 29 Aug 2019 10:19:45 -0400 Subject: [PATCH] Fix Sonar smells in the `FtpSession` --- .../integration/ftp/session/FtpSession.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java index a72baaf00a..813cbff4aa 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java @@ -151,12 +151,8 @@ public class FtpSession implements Session { @Override public void close() { try { - if (this.readingRaw.get()) { - if (!finalizeRaw()) { - if (LOGGER.isWarnEnabled()) { - LOGGER.warn("Finalize on readRaw() returned false for " + this); - } - } + if (this.readingRaw.get() && !finalizeRaw() && LOGGER.isWarnEnabled()) { + LOGGER.warn("Finalize on readRaw() returned false for " + this); } this.client.disconnect(); } @@ -181,11 +177,11 @@ public class FtpSession implements Session { this.client.deleteFile(pathTo); boolean completed = this.client.rename(pathFrom, pathTo); if (!completed) { - throw new IOException("Failed to rename '" + pathFrom + - "' to " + pathTo + SERVER_REPLIED_WITH + this.client.getReplyString()); + throw new IOException("Failed to rename " + pathFrom + + " to " + pathTo + SERVER_REPLIED_WITH + this.client.getReplyString()); } if (LOGGER.isInfoEnabled()) { - LOGGER.info("File has been successfully renamed from: " + pathFrom + " to " + pathTo); + LOGGER.info("File has been successfully renamed from " + pathFrom + " to " + pathTo); } }