You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2020/10/23 15:12:11 UTC

[mina-sshd] branch master updated (01ee7b5 -> 6c4e3f2)

This is an automated email from the ASF dual-hosted git repository.

lgoldstein pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git.


    from 01ee7b5  Upgraded OWASP dependency check plugin version to 6.0.2
     new e557eb3  [SSHD-1095] Add missing throws IOException declarations in AbstractSftpEventListener
     new 6c4e3f2  [SSHD-1096] Rethrow caught exception in SftpSubsystem#doClose

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/sshd/sftp/client/impl/DefaultSftpClient.java   |  2 +-
 .../sshd/sftp/client/impl/DefaultSftpClientFactory.java   |  2 +-
 .../sftp/server/AbstractSftpEventListenerAdapter.java     | 10 +++++-----
 .../sshd/sftp/server/AbstractSftpSubsystemHelper.java     |  8 ++++----
 .../java/org/apache/sshd/sftp/server/SftpSubsystem.java   | 15 ++++++++-------
 5 files changed, 19 insertions(+), 18 deletions(-)


[mina-sshd] 02/02: [SSHD-1096] Rethrow caught exception in SftpSubsystem#doClose

Posted by lg...@apache.org.
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 <lg...@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();
         }


[mina-sshd] 01/02: [SSHD-1095] Add missing throws IOException declarations in AbstractSftpEventListener

Posted by lg...@apache.org.
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 e557eb3078c1dba104b751af4e650dec1cab6a46
Author: Lyor Goldstein <lg...@apache.org>
AuthorDate: Fri Oct 23 18:01:41 2020 +0300

    [SSHD-1095] Add missing throws IOException declarations in AbstractSftpEventListener
---
 .../sshd/sftp/server/AbstractSftpEventListenerAdapter.java     | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/AbstractSftpEventListenerAdapter.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/AbstractSftpEventListenerAdapter.java
index 2da406c..80225b9 100644
--- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/AbstractSftpEventListenerAdapter.java
+++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/AbstractSftpEventListenerAdapter.java
@@ -33,7 +33,7 @@ import org.apache.sshd.server.session.ServerSession;
 /**
  * A no-op implementation of {@link SftpEventListener} for those who wish to implement only a small number of methods.
  * By default, all non-overridden methods simply log at TRACE level their invocation parameters
- * 
+ *
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public abstract class AbstractSftpEventListenerAdapter extends AbstractLoggingBean implements SftpEventListener {
@@ -42,14 +42,14 @@ public abstract class AbstractSftpEventListenerAdapter extends AbstractLoggingBe
     }
 
     @Override
-    public void initialized(ServerSession session, int version) {
+    public void initialized(ServerSession session, int version) throws IOException {
         if (log.isTraceEnabled()) {
             log.trace("initialized(" + session + ") version: " + version);
         }
     }
 
     @Override
-    public void destroying(ServerSession session) {
+    public void destroying(ServerSession session) throws IOException {
         if (log.isTraceEnabled()) {
             log.trace("destroying(" + session + ")");
         }
@@ -65,7 +65,7 @@ public abstract class AbstractSftpEventListenerAdapter extends AbstractLoggingBe
     }
 
     @Override
-    public void open(ServerSession session, String remoteHandle, Handle localHandle) {
+    public void open(ServerSession session, String remoteHandle, Handle localHandle) throws IOException {
         if (log.isTraceEnabled()) {
             Path path = localHandle.getFile();
             log.trace("open(" + session + ")[" + remoteHandle + "] " + (Files.isDirectory(path) ? "directory" : "file") + " "
@@ -172,7 +172,7 @@ public abstract class AbstractSftpEventListenerAdapter extends AbstractLoggingBe
     }
 
     @Override
-    public void closing(ServerSession session, String remoteHandle, Handle localHandle) {
+    public void closing(ServerSession session, String remoteHandle, Handle localHandle) throws IOException {
         if (log.isTraceEnabled()) {
             Path path = localHandle.getFile();
             log.trace("close(" + session + ")[" + remoteHandle + "] " + (Files.isDirectory(path) ? "directory" : "file") + " "