Updated Branches: refs/heads/master d555e4c67 -> d7c21f799
Clean up a bit the API to only throw IOException Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/4e9d430e Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/4e9d430e Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/4e9d430e Branch: refs/heads/master Commit: 4e9d430ee3042c72ce240684ed905ff67a403f72 Parents: d555e4c Author: Guillaume Nodet <[email protected]> Authored: Sun Jul 21 21:36:10 2013 +0200 Committer: Guillaume Nodet <[email protected]> Committed: Sun Jul 21 21:38:57 2013 +0200 ---------------------------------------------------------------------- .../java/org/apache/sshd/ClientChannel.java | 3 ++- .../java/org/apache/sshd/ClientSession.java | 20 ++++++++++---------- .../main/java/org/apache/sshd/SshClient.java | 7 ++++--- .../sshd/agent/local/AgentForwardedChannel.java | 4 ++-- .../sshd/agent/unix/AgentForwardedChannel.java | 4 ++-- .../client/channel/AbstractClientChannel.java | 4 ++-- .../sshd/client/channel/ChannelDirectTcpip.java | 6 +++--- .../apache/sshd/client/channel/ChannelExec.java | 4 +++- .../sshd/client/channel/ChannelSession.java | 4 ++-- .../sshd/client/channel/ChannelShell.java | 3 ++- .../sshd/client/channel/ChannelSubsystem.java | 4 +++- .../sshd/client/session/ClientSessionImpl.java | 20 ++++++++++---------- .../org/apache/sshd/common/TcpipForwarder.java | 14 ++++++++------ .../common/forward/DefaultTcpipForwarder.java | 12 ++++++------ .../sshd/common/forward/TcpipClientChannel.java | 4 ++-- .../sshd/common/session/AbstractSession.java | 14 +++++++------- .../sshd/server/x11/X11ForwardSupport.java | 4 ++-- 17 files changed, 70 insertions(+), 61 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/ClientChannel.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/ClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/ClientChannel.java index 83f4ac2..d19d12f 100644 --- a/sshd-core/src/main/java/org/apache/sshd/ClientChannel.java +++ b/sshd-core/src/main/java/org/apache/sshd/ClientChannel.java @@ -18,6 +18,7 @@ */ package org.apache.sshd; +import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -70,7 +71,7 @@ public interface ClientChannel { void setErr(OutputStream err); - OpenFuture open() throws Exception; + OpenFuture open() throws IOException; int waitFor(int mask, long timeout); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/ClientSession.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/ClientSession.java b/sshd-core/src/main/java/org/apache/sshd/ClientSession.java index 6686bea..8cd7f22 100644 --- a/sshd-core/src/main/java/org/apache/sshd/ClientSession.java +++ b/sshd-core/src/main/java/org/apache/sshd/ClientSession.java @@ -84,42 +84,42 @@ public interface ClientSession extends Session { * Create a channel of the given type. * Same as calling <code>createChannel(type, null)</code>. */ - ClientChannel createChannel(String type) throws Exception; + ClientChannel createChannel(String type) throws IOException; /** * Create a channel of the given type and subtype. */ - ClientChannel createChannel(String type, String subType) throws Exception; + ClientChannel createChannel(String type, String subType) throws IOException; /** * Create a channel to start a shell. */ - ChannelShell createShellChannel() throws Exception; + ChannelShell createShellChannel() throws IOException; /** * Create a channel to execute a command. */ - ChannelExec createExecChannel(String command) throws Exception; + ChannelExec createExecChannel(String command) throws IOException; /** * Create a subsystem channel. */ - ChannelSubsystem createSubsystemChannel(String subsystem) throws Exception; + ChannelSubsystem createSubsystemChannel(String subsystem) throws IOException; /** * Create a direct tcp-ip channel which can be used to stream data to a remote port from the server. */ - ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws Exception; + ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws IOException; /** * Start forwarding the given local address on the client to the given address on the server. */ - SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws Exception; + SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws IOException; /** * Stop forwarding the given local address. */ - void stopLocalPortForwarding(SshdSocketAddress local) throws Exception; + void stopLocalPortForwarding(SshdSocketAddress local) throws IOException; /** * Start forwarding tcpip from the given address on the server to the @@ -138,12 +138,12 @@ public interface ClientSession extends Session { * </ul> * */ - SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws Exception; + SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws IOException; /** * Stop forwarding of the given remote address. */ - void stopRemotePortForwarding(SshdSocketAddress remote) throws Exception; + void stopRemotePortForwarding(SshdSocketAddress remote) throws IOException; /** * Wait for a specific state. http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/SshClient.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/SshClient.java b/sshd-core/src/main/java/org/apache/sshd/SshClient.java index 797d6a0..515a866 100644 --- a/sshd-core/src/main/java/org/apache/sshd/SshClient.java +++ b/sshd-core/src/main/java/org/apache/sshd/SshClient.java @@ -21,6 +21,7 @@ package org.apache.sshd; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Writer; @@ -232,7 +233,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa } } - public ConnectFuture connect(String host, int port) throws Exception { + public ConnectFuture connect(String host, int port) throws IOException { assert host != null; assert port >= 0; if (connector == null) { @@ -242,7 +243,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa return connect(address); } - public ConnectFuture connect(SocketAddress address) throws Exception { + public ConnectFuture connect(SocketAddress address) throws IOException { assert address != null; if (connector == null) { throw new IllegalStateException("SshClient not started. Please call start() method before connecting to a server"); @@ -302,7 +303,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa ForwardingAcceptorFactory faf = new DefaultForwardingAcceptorFactory(); client.setTcpipForwardingAcceptorFactory(faf); TcpipForwarderFactory tcpipForwarderFactory = new DefaultTcpipForwarderFactory(); - client.setTcpipForwarderFactory( tcpipForwarderFactory ); + client.setTcpipForwarderFactory(tcpipForwarderFactory); client.setServerKeyVerifier(AcceptAllServerKeyVerifier.INSTANCE); return client; } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentForwardedChannel.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentForwardedChannel.java b/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentForwardedChannel.java index 0f1c0ae..8b29f70 100644 --- a/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentForwardedChannel.java +++ b/sshd-core/src/main/java/org/apache/sshd/agent/local/AgentForwardedChannel.java @@ -69,12 +69,12 @@ public class AgentForwardedChannel extends AbstractClientChannel { } } - public OpenFuture open() throws Exception { + public OpenFuture open() throws IOException { return internalOpen(); } @Override - protected void doOpen() throws Exception { + protected void doOpen() throws IOException { invertedIn = new ChannelOutputStream(this, remoteWindow, log, SshConstants.Message.SSH_MSG_CHANNEL_DATA); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentForwardedChannel.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentForwardedChannel.java b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentForwardedChannel.java index 8c0aaa6..3207074 100644 --- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentForwardedChannel.java +++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentForwardedChannel.java @@ -56,12 +56,12 @@ public class AgentForwardedChannel extends AbstractClientChannel implements Runn } } - public synchronized OpenFuture open() throws Exception { + public synchronized OpenFuture open() throws IOException { return internalOpen(); } @Override - protected synchronized void doOpen() throws Exception { + protected synchronized void doOpen() throws IOException { out = new ChannelOutputStream(this, remoteWindow, log, SshConstants.Message.SSH_MSG_CHANNEL_DATA); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java index cc8a194..715ae82 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java @@ -170,7 +170,7 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C } } - protected OpenFuture internalOpen() throws Exception { + protected OpenFuture internalOpen() throws IOException { if (closeFuture.isClosed()) { throw new SshException("Session has been closed"); } @@ -207,7 +207,7 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C } } - protected abstract void doOpen() throws Exception; + protected abstract void doOpen() throws IOException; public void handleOpenFailure(Buffer buffer) { int reason = buffer.getInt(); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelDirectTcpip.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelDirectTcpip.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelDirectTcpip.java index 83b6186..d262d42 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelDirectTcpip.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelDirectTcpip.java @@ -60,7 +60,7 @@ public class ChannelDirectTcpip extends AbstractClientChannel { } @Override - protected OpenFuture internalOpen() throws Exception { + protected OpenFuture internalOpen() throws IOException { if (closeFuture.isClosed()) { throw new SshException("Session has been closed"); } @@ -80,12 +80,12 @@ public class ChannelDirectTcpip extends AbstractClientChannel { } @Override - protected void doOpen() throws Exception { + protected void doOpen() throws IOException { out = new ChannelOutputStream(this, remoteWindow, log, SshConstants.Message.SSH_MSG_CHANNEL_DATA); in = new PipedInputStream(pipe); } - public OpenFuture open() throws Exception { + public OpenFuture open() throws IOException { return internalOpen(); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelExec.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelExec.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelExec.java index 756a854..8a1146f 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelExec.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelExec.java @@ -18,6 +18,8 @@ */ package org.apache.sshd.client.channel; +import java.io.IOException; + import org.apache.sshd.common.SshConstants; import org.apache.sshd.common.util.Buffer; @@ -37,7 +39,7 @@ public class ChannelExec extends ChannelSession { this.command = command; } - protected void doOpen() throws Exception { + protected void doOpen() throws IOException { super.doOpen(); log.info("Send SSH_MSG_CHANNEL_REQUEST exec"); Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_REQUEST, 0); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java index 8a64682..fe2ef23 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java @@ -39,7 +39,7 @@ public class ChannelSession extends AbstractClientChannel { super("session"); } - public OpenFuture open() throws Exception { + public OpenFuture open() throws IOException { invertedIn = new ChannelOutputStream(this, remoteWindow, log, SshConstants.Message.SSH_MSG_CHANNEL_DATA); if (out == null || err == null) { throw new IllegalStateException("in, out and err streams should be set before opening channel"); @@ -48,7 +48,7 @@ public class ChannelSession extends AbstractClientChannel { } @Override - protected void doOpen() throws Exception { + protected void doOpen() throws IOException { if (in != null) { streamPumper = new Thread("ClientInputStreamPump") { @Override http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelShell.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelShell.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelShell.java index 3c3fca4..b060f63 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelShell.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelShell.java @@ -18,6 +18,7 @@ */ package org.apache.sshd.client.channel; +import java.io.IOException; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -147,7 +148,7 @@ public class ChannelShell extends ChannelSession { env.put(key, value); } - protected void doOpen() throws Exception { + protected void doOpen() throws IOException { super.doOpen(); Buffer buffer; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java index 5833b80..c11dd89 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSubsystem.java @@ -18,6 +18,8 @@ */ package org.apache.sshd.client.channel; +import java.io.IOException; + import org.apache.sshd.common.SshConstants; import org.apache.sshd.common.util.Buffer; @@ -37,7 +39,7 @@ public class ChannelSubsystem extends ChannelSession { this.subsystem = subsystem; } - protected void doOpen() throws Exception { + protected void doOpen() throws IOException { super.doOpen(); log.info("Send SSH_MSG_CHANNEL_REQUEST exec"); Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_REQUEST, 0); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java index 76a2f54..ccc21bc 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java @@ -210,11 +210,11 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession } } - public ClientChannel createChannel(String type) throws Exception { + public ClientChannel createChannel(String type) throws IOException { return createChannel(type, null); } - public ClientChannel createChannel(String type, String subType) throws Exception { + public ClientChannel createChannel(String type, String subType) throws IOException { if (ClientChannel.CHANNEL_SHELL.equals(type)) { return createShellChannel(); } else if (ClientChannel.CHANNEL_EXEC.equals(type)) { @@ -226,43 +226,43 @@ public class ClientSessionImpl extends AbstractSession implements ClientSession } } - public ChannelShell createShellChannel() throws Exception { + public ChannelShell createShellChannel() throws IOException { ChannelShell channel = new ChannelShell(); registerChannel(channel); return channel; } - public ChannelExec createExecChannel(String command) throws Exception { + public ChannelExec createExecChannel(String command) throws IOException { ChannelExec channel = new ChannelExec(command); registerChannel(channel); return channel; } - public ChannelSubsystem createSubsystemChannel(String subsystem) throws Exception { + public ChannelSubsystem createSubsystemChannel(String subsystem) throws IOException { ChannelSubsystem channel = new ChannelSubsystem(subsystem); registerChannel(channel); return channel; } - public ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws Exception { + public ChannelDirectTcpip createDirectTcpipChannel(SshdSocketAddress local, SshdSocketAddress remote) throws IOException { ChannelDirectTcpip channel = new ChannelDirectTcpip(local, remote); registerChannel(channel); return channel; } - public SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws Exception { + public SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws IOException { return getTcpipForwarder().startLocalPortForwarding(local, remote); } - public void stopLocalPortForwarding(SshdSocketAddress local) throws Exception { + public void stopLocalPortForwarding(SshdSocketAddress local) throws IOException { getTcpipForwarder().stopLocalPortForwarding(local); } - public SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws Exception { + public SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws IOException { return getTcpipForwarder().startRemotePortForwarding(remote, local); } - public void stopRemotePortForwarding(SshdSocketAddress remote) throws Exception { + public void stopRemotePortForwarding(SshdSocketAddress remote) throws IOException { getTcpipForwarder().stopRemotePortForwarding(remote); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/common/TcpipForwarder.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/TcpipForwarder.java b/sshd-core/src/main/java/org/apache/sshd/common/TcpipForwarder.java index 5594456..e36abce 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/TcpipForwarder.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/TcpipForwarder.java @@ -19,17 +19,19 @@ package org.apache.sshd.common; +import java.io.IOException; + public interface TcpipForwarder { /** * Start forwarding the given local address on the client to the given address on the server. */ - SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws Exception; + SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws IOException; /** * Stop forwarding the given local address. */ - void stopLocalPortForwarding(SshdSocketAddress local) throws Exception; + void stopLocalPortForwarding(SshdSocketAddress local) throws IOException; /** * Start forwarding tcpip from the given remote address to the @@ -48,12 +50,12 @@ public interface TcpipForwarder { * </ul> * */ - SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws Exception; + SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws IOException; /** * Stop forwarding of the given remote address. */ - void stopRemotePortForwarding(SshdSocketAddress remote) throws Exception; + void stopRemotePortForwarding(SshdSocketAddress remote) throws IOException; /** * Retrieve the local address that the remote port is forwarded to @@ -68,14 +70,14 @@ public interface TcpipForwarder { * @return the list of bound local addresses * @throws Exception */ - SshdSocketAddress localPortForwardingRequested(SshdSocketAddress local) throws Exception; + SshdSocketAddress localPortForwardingRequested(SshdSocketAddress local) throws IOException; /** * Called when the other side cancelled a remote port forward. * @param local * @throws Exception */ - void localPortForwardingCancelled(SshdSocketAddress local) throws Exception; + void localPortForwardingCancelled(SshdSocketAddress local) throws IOException; /** * Close the forwarder http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java index 4b50bb7..ba986e1 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultTcpipForwarder.java @@ -70,7 +70,7 @@ public class DefaultTcpipForwarder extends IoHandlerAdapter implements TcpipForw // TcpIpForwarder implementation // - public synchronized SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws Exception { + public synchronized SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, SshdSocketAddress remote) throws IOException { if (local == null) { throw new IllegalArgumentException("Local address is null"); } @@ -85,7 +85,7 @@ public class DefaultTcpipForwarder extends IoHandlerAdapter implements TcpipForw return bound; } - public synchronized void stopLocalPortForwarding(SshdSocketAddress local) throws Exception { + public synchronized void stopLocalPortForwarding(SshdSocketAddress local) throws IOException { if (localToRemote.remove(local.getPort()) != null && acceptor != null) { acceptor.unbind(local.toInetSocketAddress()); if (acceptor.getLocalAddresses().isEmpty()) { @@ -94,7 +94,7 @@ public class DefaultTcpipForwarder extends IoHandlerAdapter implements TcpipForw } } - public synchronized SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws Exception { + public synchronized SshdSocketAddress startRemotePortForwarding(SshdSocketAddress remote, SshdSocketAddress local) throws IOException { Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_GLOBAL_REQUEST, 0); buffer.putString("tcpip-forward"); buffer.putBoolean(true); @@ -110,7 +110,7 @@ public class DefaultTcpipForwarder extends IoHandlerAdapter implements TcpipForw return new SshdSocketAddress(remote.getHostName(), port); } - public synchronized void stopRemotePortForwarding(SshdSocketAddress remote) throws Exception { + public synchronized void stopRemotePortForwarding(SshdSocketAddress remote) throws IOException { if (remoteToLocal.remove(remote.getPort()) != null) { Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_GLOBAL_REQUEST, 0); buffer.putString("cancel-tcpip-forward"); @@ -125,7 +125,7 @@ public class DefaultTcpipForwarder extends IoHandlerAdapter implements TcpipForw return remoteToLocal.get(remotePort); } - public synchronized SshdSocketAddress localPortForwardingRequested(SshdSocketAddress local) throws Exception { + public synchronized SshdSocketAddress localPortForwardingRequested(SshdSocketAddress local) throws IOException { if (local == null) { throw new IllegalArgumentException("Local address is null"); } @@ -141,7 +141,7 @@ public class DefaultTcpipForwarder extends IoHandlerAdapter implements TcpipForw return bound; } - public synchronized void localPortForwardingCancelled(SshdSocketAddress local) throws Exception { + public synchronized void localPortForwardingCancelled(SshdSocketAddress local) throws IOException { if (localForwards.remove(local) && acceptor != null) { acceptor.unbind(local.toInetSocketAddress()); if (acceptor.getLocalAddresses().isEmpty()) { http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipClientChannel.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipClientChannel.java index 03b3070..d0c4de8 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipClientChannel.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipClientChannel.java @@ -60,7 +60,7 @@ public class TcpipClientChannel extends AbstractClientChannel { return openFuture; } - public synchronized OpenFuture open() throws Exception { + public synchronized OpenFuture open() throws IOException { InetSocketAddress src = null, dst = null; switch (typeEnum) { case Direct: @@ -91,7 +91,7 @@ public class TcpipClientChannel extends AbstractClientChannel { } @Override - protected synchronized void doOpen() throws Exception { + protected synchronized void doOpen() throws IOException { out = new ChannelOutputStream(this, remoteWindow, log, SshConstants.Message.SSH_MSG_CHANNEL_DATA); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java b/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java index 60e4b47..456ba40 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java @@ -988,7 +988,7 @@ public abstract class AbstractSession implements Session { } } - public int registerChannel(Channel channel) throws Exception { + public int registerChannel(Channel channel) throws IOException { int channelId = getNextChannelId(); channel.init(this, channelId); channels.put(channelId, channel); @@ -1017,7 +1017,7 @@ public abstract class AbstractSession implements Session { * @param buffer the buffer containing the data * @throws Exception if an error occurs */ - protected void channelData(Buffer buffer) throws Exception { + protected void channelData(Buffer buffer) throws IOException { Channel channel = getChannel(buffer); channel.handleData(buffer); } @@ -1028,7 +1028,7 @@ public abstract class AbstractSession implements Session { * @param buffer the buffer containing the data * @throws Exception if an error occurs */ - protected void channelExtendedData(Buffer buffer) throws Exception { + protected void channelExtendedData(Buffer buffer) throws IOException { Channel channel = getChannel(buffer); channel.handleExtendedData(buffer); } @@ -1039,7 +1039,7 @@ public abstract class AbstractSession implements Session { * @param buffer the buffer containing the window adjustement parameters * @throws Exception if an error occurs */ - protected void channelWindowAdjust(Buffer buffer) throws Exception { + protected void channelWindowAdjust(Buffer buffer) throws IOException { try { Channel channel = getChannel(buffer); channel.handleWindowAdjust(buffer); @@ -1054,7 +1054,7 @@ public abstract class AbstractSession implements Session { * @param buffer the buffer containing the packet * @throws Exception if an error occurs */ - protected void channelEof(Buffer buffer) throws Exception { + protected void channelEof(Buffer buffer) throws IOException { Channel channel = getChannel(buffer); channel.handleEof(); } @@ -1065,7 +1065,7 @@ public abstract class AbstractSession implements Session { * @param buffer the buffer containing the packet * @throws Exception if an error occurs */ - protected void channelClose(Buffer buffer) throws Exception { + protected void channelClose(Buffer buffer) throws IOException { Channel channel = getChannel(buffer); channel.handleClose(); unregisterChannel(channel); @@ -1097,7 +1097,7 @@ public abstract class AbstractSession implements Session { * @param buffer the buffer containing the packet * @throws Exception if an error occurs */ - protected void channelFailure(Buffer buffer) throws Exception { + protected void channelFailure(Buffer buffer) throws IOException { Channel channel = getChannel(buffer); channel.handleFailure(); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/4e9d430e/sshd-core/src/main/java/org/apache/sshd/server/x11/X11ForwardSupport.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/x11/X11ForwardSupport.java b/sshd-core/src/main/java/org/apache/sshd/server/x11/X11ForwardSupport.java index 23479a3..37ec331 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/x11/X11ForwardSupport.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/x11/X11ForwardSupport.java @@ -183,7 +183,7 @@ public class X11ForwardSupport extends IoHandlerAdapter { this.serverSession = serverSession; } - public synchronized OpenFuture open() throws Exception { + public synchronized OpenFuture open() throws IOException { InetSocketAddress remote = (InetSocketAddress) serverSession.getRemoteAddress(); if (closeFuture.isClosed()) { throw new SshException("Session has been closed"); @@ -202,7 +202,7 @@ public class X11ForwardSupport extends IoHandlerAdapter { } @Override - protected synchronized void doOpen() throws Exception { + protected synchronized void doOpen() throws IOException { out = new ChannelOutputStream(this, remoteWindow, log, SshConstants.Message.SSH_MSG_CHANNEL_DATA); }
