Sonar fixes

- a few complexities
- final method calls from ctor
- raw exception throwing
- useless overrides
- loss of stack trace
This commit is contained in:
Gary Russell
2019-04-29 16:34:39 -04:00
committed by Artem Bilan
parent 7569d0ad79
commit 36c33bb5ab
45 changed files with 134 additions and 114 deletions

View File

@@ -208,14 +208,19 @@ public class SftpSession implements Session<LsEntry> {
}
}
catch (IOException ioex) {
throw new NestedIOException("Failed to delete file " + pathTo, ioex);
NestedIOException exception = new NestedIOException("Failed to delete file " + pathTo, sftpex);
exception.addSuppressed(ioex);
throw exception; // NOSONAR - added to suppressed exceptions
}
try {
// attempt to rename again
this.channel.rename(pathFrom, pathTo);
}
catch (SftpException sftpex2) {
throw new NestedIOException("failed to rename from " + pathFrom + " to " + pathTo, sftpex2);
NestedIOException exception =
new NestedIOException("failed to rename from " + pathFrom + " to " + pathTo, sftpex);
exception.addSuppressed(sftpex2);
throw exception; // NOSONAR - added to suppressed exceptions
}
}
if (this.logger.isDebugEnabled()) {