This is an automated email from the ASF dual-hosted git repository. lgoldstein pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
commit 6c4e3f2fa692fd26e8445748ef6ece88bd416c00 Author: Lyor Goldstein <lgoldst...@apache.org> AuthorDate: Fri Oct 23 18:11:38 2020 +0300 [SSHD-1096] Rethrow caught exception in SftpSubsystem#doClose --- .../apache/sshd/sftp/client/impl/DefaultSftpClient.java | 2 +- .../sshd/sftp/client/impl/DefaultSftpClientFactory.java | 2 +- .../sshd/sftp/server/AbstractSftpSubsystemHelper.java | 8 ++++---- .../java/org/apache/sshd/sftp/server/SftpSubsystem.java | 15 ++++++++------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/DefaultSftpClient.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/DefaultSftpClient.java index ba29ed4..ccc15d0 100644 --- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/DefaultSftpClient.java +++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/DefaultSftpClient.java @@ -106,7 +106,7 @@ public class DefaultSftpClient extends AbstractSftpClient { try { init(clientSession, initialVersionSelector, initializationTimeout); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { this.channel.close(true); throw e; } diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/DefaultSftpClientFactory.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/DefaultSftpClientFactory.java index ef0ddac..d62f28b 100644 --- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/DefaultSftpClientFactory.java +++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/DefaultSftpClientFactory.java @@ -47,7 +47,7 @@ public class DefaultSftpClientFactory extends AbstractLoggingBean implements Sft DefaultSftpClient client = createDefaultSftpClient(session, selector); try { client.negotiateVersion(selector); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { debug("createSftpClient({}) failed ({}) to negotiate version: {}", session, e.getClass().getSimpleName(), e.getMessage(), e); client.close(); diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/AbstractSftpSubsystemHelper.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/AbstractSftpSubsystemHelper.java index c783276..83d160e 100644 --- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/AbstractSftpSubsystemHelper.java +++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/AbstractSftpSubsystemHelper.java @@ -1199,7 +1199,7 @@ public abstract class AbstractSftpSubsystemHelper try { SftpFileSystemAccessor accessor = getFileSystemAccessor(); accessor.renameFile(session, this, o, n, opts); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { listener.moved(session, o, n, opts, e); throw e; } @@ -1537,7 +1537,7 @@ public abstract class AbstractSftpSubsystemHelper try { SftpFileSystemAccessor accessor = getFileSystemAccessor(); accessor.removeFile(session, this, p, isDirectory); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { listener.removed(session, p, isDirectory, e); throw e; } @@ -1591,7 +1591,7 @@ public abstract class AbstractSftpSubsystemHelper boolean followLinks = resolvePathResolutionFollowLinks( SftpConstants.SSH_FXP_MKDIR, "", p); doSetAttributes(p, attrs, followLinks); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { listener.created(session, p, attrs, e); throw e; } @@ -2468,7 +2468,7 @@ public abstract class AbstractSftpSubsystemHelper listener.modifyingAttributes(session, file, attributes); try { setFileAttributes(file, attributes, IoUtils.getLinkOptions(followLinks)); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { listener.modifiedAttributes(session, file, attributes, e); throw e; } diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java index 5ad6869..8c301de 100644 --- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java +++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java @@ -316,7 +316,7 @@ public class SftpSubsystem try { SftpFileSystemAccessor accessor = getFileSystemAccessor(); accessor.createLink(session, this, link, existing, symLink); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { listener.linked(session, link, existing, symLink, e); throw e; } @@ -510,7 +510,7 @@ public class SftpSubsystem listener.blocking(session, handle, fileHandle, offset, length, mask); try { fileHandle.lock(offset, length, mask); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { listener.blocked(session, handle, fileHandle, offset, length, mask, e); throw e; } @@ -531,7 +531,7 @@ public class SftpSubsystem listener.unblocking(session, handle, fileHandle, offset, length); try { fileHandle.unlock(offset, length); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { listener.unblocked(session, handle, fileHandle, offset, length, e); throw e; } @@ -688,7 +688,7 @@ public class SftpSubsystem } Objects.requireNonNull(reply, "No reply buffer created"); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { sendStatus(prepareReply(buffer), id, e, SftpConstants.SSH_FXP_READDIR, handle); return; } @@ -785,7 +785,7 @@ public class SftpSubsystem } else { fh.write(data, doff, length, offset); } - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { listener.written(session, handle, fh, offset, data, doff, length, e); throw e; } @@ -810,7 +810,7 @@ public class SftpSubsystem listener.reading(session, handle, fh, offset, data, doff, length); try { readLen = fh.read(data, doff, length, offset); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { listener.read(session, handle, fh, offset, data, doff, length, -1, e); throw e; } @@ -832,8 +832,9 @@ public class SftpSubsystem listener.closing(session, handle, nodeHandle); nodeHandle.close(); listener.closed(session, handle, nodeHandle, null); - } catch (IOException | RuntimeException e) { + } catch (IOException | RuntimeException | Error e) { listener.closed(session, handle, nodeHandle, e); + throw e; } finally { nodeHandle.clearAttributes(); }