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

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


The following commit(s) were added to refs/heads/master by this push:
     new ebc5fbd  [SSHD-1048] Wrap instead of rethrow IOException in Future
ebc5fbd is described below

commit ebc5fbd8018045d12d7ba9bb511a29b3c045ed08
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Jul 31 14:56:24 2020 +0200

    [SSHD-1048] Wrap instead of rethrow IOException in Future
---
 CHANGES.md                                                 |  1 +
 .../org/apache/sshd/common/future/AbstractSshFuture.java   | 14 ++------------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index fc54a85..1fe76d1 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -32,3 +32,4 @@
 * [SSHD-1032](https://issues.apache.org/jira/browse/SSHD-1032) Fix possible 
ArrayIndexOutOfBoundsException in ChannelAsyncOutputStream.
 * [SSHD-1033](https://issues.apache.org/jira/browse/SSHD-1033) Fix 
simultaneous usage of dynamic and local port forwarding.
 * [SSHD-1039](https://issues.apache.org/jira/browse/SSHD-1039) Fix support for 
some basic options in ssh/sshd cli.
+* [SSHD-1048](https://issues.apache.org/jira/browse/SSHD-1048) Wrap instead of 
rethrow IOException in Future.
diff --git 
a/sshd-common/src/main/java/org/apache/sshd/common/future/AbstractSshFuture.java
 
b/sshd-common/src/main/java/org/apache/sshd/common/future/AbstractSshFuture.java
index 48ab284..a0188f1 100644
--- 
a/sshd-common/src/main/java/org/apache/sshd/common/future/AbstractSshFuture.java
+++ 
b/sshd-common/src/main/java/org/apache/sshd/common/future/AbstractSshFuture.java
@@ -92,12 +92,6 @@ public abstract class AbstractSshFuture<T extends SshFuture> 
extends AbstractLog
      *
      * <LI>
      * <P>
-     * If the result is an {@link IOException} then re-throw it
-     * </P>
-     * </LI>
-     *
-     * <LI>
-     * <P>
      * If the result is a {@link Throwable} then throw an {@link IOException} 
whose cause is the original exception
      * </P>
      * </LI>
@@ -131,13 +125,9 @@ public abstract class AbstractSshFuture<T extends 
SshFuture> extends AbstractLog
 
         if (Throwable.class.isAssignableFrom(actualType)) {
             Throwable t = GenericUtils.peelException((Throwable) value);
-            if (t != value) {
-                value = t;
-                actualType = value.getClass();
-            }
 
-            if (IOException.class.isAssignableFrom(actualType)) {
-                throw (IOException) value;
+            if (t instanceof SshException) {
+                throw new SshException(((SshException) t).getDisconnectCode(), 
t.getMessage(), t);
             }
 
             Throwable cause = GenericUtils.resolveExceptionCause(t);

Reply via email to