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 2018/04/19 08:32:56 UTC
[1/5] mina-sshd git commit: [SSHD-821] A few code-style fixes for
async authentication code
Repository: mina-sshd
Updated Branches:
refs/heads/master 598c991fe -> ec9c0d8d0
[SSHD-821] A few code-style fixes for async authentication code
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/66432b01
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/66432b01
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/66432b01
Branch: refs/heads/master
Commit: 66432b0101f186e6d9e11815857039e59f430f74
Parents: 34f1e13
Author: Lyor Goldstein <ly...@gmail.com>
Authored: Thu Apr 19 11:02:54 2018 +0300
Committer: Lyor Goldstein <ly...@gmail.com>
Committed: Thu Apr 19 11:36:19 2018 +0300
----------------------------------------------------------------------
.../sshd/server/auth/AsyncAuthException.java | 20 ++++++++++----------
.../server/auth/AsyncAuthInteractiveTest.java | 3 +--
.../apache/sshd/server/auth/AsyncAuthTest.java | 4 +++-
3 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/66432b01/sshd-core/src/main/java/org/apache/sshd/server/auth/AsyncAuthException.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/AsyncAuthException.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/AsyncAuthException.java
index 0a95986..5b3b24e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/AsyncAuthException.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/AsyncAuthException.java
@@ -25,8 +25,6 @@ import java.util.function.Consumer;
import org.apache.sshd.common.RuntimeSshException;
/**
- *
- *
* @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
*/
public class AsyncAuthException extends RuntimeSshException {
@@ -49,13 +47,16 @@ public class AsyncAuthException extends RuntimeSshException {
this.authed = authed;
listener = this.listener;
}
+
if (listener != null) {
- if (listener instanceof Consumer) {
- asListener(listener).accept(authed);
+ if (listener instanceof Consumer<?>) {
+ Consumer<? super Boolean> lst = asListener(listener);
+ lst.accept(authed);
} else {
int l = Array.getLength(listener);
for (int i = 0; i < l; i++) {
- Consumer<Boolean> lst = asListener(Array.get(listener, i));
+ Object lstInstance = Array.get(listener, i);
+ Consumer<? super Boolean> lst = asListener(lstInstance);
if (lst != null) {
lst.accept(authed);
}
@@ -65,16 +66,16 @@ public class AsyncAuthException extends RuntimeSshException {
}
@SuppressWarnings("unchecked")
- protected static Consumer<Boolean> asListener(Object listener) {
- return (Consumer<Boolean>) listener;
+ protected Consumer<? super Boolean> asListener(Object listener) {
+ return (Consumer<? super Boolean>) listener;
}
- public void addListener(Consumer<Boolean> listener) {
+ public void addListener(Consumer<? super Boolean> listener) {
Boolean result;
synchronized (this) {
if (this.listener == null) {
this.listener = listener;
- } else if (this.listener instanceof Consumer) {
+ } else if (this.listener instanceof Consumer<?>) {
this.listener = new Object[] {this.listener, listener };
} else {
Object[] ol = (Object[]) this.listener;
@@ -90,5 +91,4 @@ public class AsyncAuthException extends RuntimeSshException {
listener.accept(result);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/66432b01/sshd-core/src/test/java/org/apache/sshd/server/auth/AsyncAuthInteractiveTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/auth/AsyncAuthInteractiveTest.java b/sshd-core/src/test/java/org/apache/sshd/server/auth/AsyncAuthInteractiveTest.java
index 42763ef..4b81fe4 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/auth/AsyncAuthInteractiveTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/auth/AsyncAuthInteractiveTest.java
@@ -32,13 +32,12 @@ import org.junit.runners.MethodSorters;
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class AsyncAuthInteractiveTest extends AsyncAuthTestBase {
-
public AsyncAuthInteractiveTest() {
super();
}
+ @Override
protected boolean authenticate() throws Exception {
-
JSch jsch = new JSch();
Session session;
ChannelShell channel;
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/66432b01/sshd-core/src/test/java/org/apache/sshd/server/auth/AsyncAuthTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/auth/AsyncAuthTest.java b/sshd-core/src/test/java/org/apache/sshd/server/auth/AsyncAuthTest.java
index 5f8f591..aa557e1 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/auth/AsyncAuthTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/auth/AsyncAuthTest.java
@@ -37,8 +37,8 @@ public class AsyncAuthTest extends AsyncAuthTestBase {
super();
}
+ @Override
protected boolean authenticate() throws Exception {
-
JSch jsch = new JSch();
Session session;
ChannelShell channel;
@@ -91,11 +91,13 @@ public class AsyncAuthTest extends AsyncAuthTestBase {
try {
channel.disconnect();
} catch (Exception ignore) {
+ // ignored
}
try {
session.disconnect();
} catch (Exception ignore) {
+ // ignored
}
return true;
[2/5] mina-sshd git commit: [SSHD-817] A few minor code fixes to
Netty code
Posted by lg...@apache.org.
[SSHD-817] A few minor code fixes to Netty code
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/34f1e13f
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/34f1e13f
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/34f1e13f
Branch: refs/heads/master
Commit: 34f1e13f02d1fa2c22767a08c9588c9fbfaad5dd
Parents: 229d6f3
Author: Lyor Goldstein <ly...@gmail.com>
Authored: Thu Apr 19 11:01:55 2018 +0300
Committer: Lyor Goldstein <ly...@gmail.com>
Committed: Thu Apr 19 11:36:19 2018 +0300
----------------------------------------------------------------------
.../io/DefaultIoServiceFactoryFactory.java | 30 ++++++++++----
.../org/apache/sshd/netty/NettyIoAcceptor.java | 31 +++++++-------
.../org/apache/sshd/netty/NettyIoConnector.java | 30 +++++++-------
.../sshd/netty/NettyIoServiceFactory.java | 6 ++-
.../org/apache/sshd/netty/NettyIoSession.java | 43 +++++++++++++-------
.../org/apache/sshd/netty/NettySupport.java | 7 +++-
6 files changed, 90 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/34f1e13f/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java
index cfba0f4..3f4d2a4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java
@@ -46,7 +46,8 @@ public class DefaultIoServiceFactoryFactory extends AbstractIoServiceFactoryFact
@Override
public IoServiceFactory create(FactoryManager manager) {
- return getFactory().create(manager);
+ IoServiceFactoryFactory factoryInstance = getFactory();
+ return factoryInstance.create(manager);
}
private IoServiceFactoryFactory getFactory() {
@@ -69,15 +70,18 @@ public class DefaultIoServiceFactoryFactory extends AbstractIoServiceFactoryFact
return newInstance(clazz, factory);
}
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Thread currentThread = Thread.currentThread();
+ ClassLoader cl = currentThread.getContextClassLoader();
if (cl != null) {
T t = tryLoad(ServiceLoader.load(clazz, cl));
if (t != null) {
return t;
}
}
- if (cl != DefaultIoServiceFactoryFactory.class.getClassLoader()) {
- T t = tryLoad(ServiceLoader.load(clazz, DefaultIoServiceFactoryFactory.class.getClassLoader()));
+
+ ClassLoader clDefault = DefaultIoServiceFactoryFactory.class.getClassLoader();
+ if (cl != clDefault) {
+ T t = tryLoad(ServiceLoader.load(clazz, clDefault));
if (t != null) {
return t;
}
@@ -104,20 +108,28 @@ public class DefaultIoServiceFactoryFactory extends AbstractIoServiceFactoryFact
public static <T extends IoServiceFactoryFactory> T newInstance(Class<T> clazz, String factory) {
BuiltinIoServiceFactoryFactories builtin = BuiltinIoServiceFactoryFactories.fromFactoryName(factory);
if (builtin != null) {
- return clazz.cast(builtin.create());
+ IoServiceFactoryFactory builtinInstance = builtin.create();
+ return clazz.cast(builtinInstance);
}
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Thread currentThread = Thread.currentThread();
+ ClassLoader cl = currentThread.getContextClassLoader();
if (cl != null) {
try {
- return clazz.cast(cl.loadClass(factory).newInstance());
+ Class<?> loaded = cl.loadClass(factory);
+ Object factoryInstance = loaded.newInstance();
+ return clazz.cast(factoryInstance);
} catch (Throwable t) {
LOGGER.trace("Exception while loading factory " + factory, t);
}
}
- if (cl != DefaultIoServiceFactoryFactory.class.getClassLoader()) {
+
+ ClassLoader clDefault = DefaultIoServiceFactoryFactory.class.getClassLoader();
+ if (cl != clDefault) {
try {
- return clazz.cast(DefaultIoServiceFactoryFactory.class.getClassLoader().loadClass(factory).newInstance());
+ Class<?> loaded = clDefault.loadClass(factory);
+ Object factoryInstance = loaded.newInstance();
+ return clazz.cast(factoryInstance);
} catch (Throwable t) {
LOGGER.trace("Exception while loading factory " + factory, t);
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/34f1e13f/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoAcceptor.java
----------------------------------------------------------------------
diff --git a/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoAcceptor.java b/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoAcceptor.java
index 8d88cdf..7f710e1 100644
--- a/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoAcceptor.java
+++ b/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoAcceptor.java
@@ -24,10 +24,10 @@ import java.io.InterruptedIOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Collection;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import org.apache.sshd.common.future.CloseFuture;
@@ -55,10 +55,9 @@ import io.netty.util.concurrent.GlobalEventExecutor;
* @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
*/
public class NettyIoAcceptor extends NettyIoService implements IoAcceptor {
-
protected final ServerBootstrap bootstrap = new ServerBootstrap();
protected final DefaultCloseFuture closeFuture = new DefaultCloseFuture(toString(), lock);
- protected final Map<SocketAddress, Channel> boundAddresses = new HashMap<>();
+ protected final Map<SocketAddress, Channel> boundAddresses = new ConcurrentHashMap<>();
protected final IoHandler handler;
public NettyIoAcceptor(NettyIoServiceFactory factory, IoHandler handler) {
@@ -66,16 +65,18 @@ public class NettyIoAcceptor extends NettyIoService implements IoAcceptor {
this.handler = handler;
channelGroup = new DefaultChannelGroup("sshd-acceptor-channels", GlobalEventExecutor.INSTANCE);
bootstrap.group(factory.eventLoopGroup)
- .channel(NioServerSocketChannel.class)
- .option(ChannelOption.SO_BACKLOG, 100)
- .handler(new LoggingHandler(LogLevel.INFO))
- .childHandler(new ChannelInitializer<SocketChannel>() {
- @Override
- public void initChannel(SocketChannel ch) throws Exception {
- ChannelPipeline p = ch.pipeline();
- p.addLast(new NettyIoSession(NettyIoAcceptor.this, handler).adapter);
- }
- });
+ .channel(NioServerSocketChannel.class)
+ .option(ChannelOption.SO_BACKLOG, 100) // TODO make this configurable
+ .handler(new LoggingHandler(LogLevel.INFO)) // TODO make this configurable
+ .childHandler(new ChannelInitializer<SocketChannel>() {
+ @Override
+ public void initChannel(SocketChannel ch) throws Exception {
+ ChannelPipeline p = ch.pipeline();
+ @SuppressWarnings("resource")
+ NettyIoSession nettyIoSession = new NettyIoSession(NettyIoAcceptor.this, handler);
+ p.addLast(nettyIoSession.adapter);
+ }
+ });
}
@Override
@@ -107,7 +108,7 @@ public class NettyIoAcceptor extends NettyIoService implements IoAcceptor {
public void unbind(Collection<? extends SocketAddress> addresses) {
CountDownLatch latch = new CountDownLatch(addresses.size());
for (SocketAddress address : addresses) {
- Channel channel = boundAddresses.get(address);
+ Channel channel = boundAddresses.remove(address);
if (channel != null) {
ChannelFuture fut;
if (channel.isOpen()) {
@@ -129,7 +130,7 @@ public class NettyIoAcceptor extends NettyIoService implements IoAcceptor {
@Override
public void unbind(SocketAddress address) {
- Channel channel = boundAddresses.get(address);
+ Channel channel = boundAddresses.remove(address);
if (channel != null) {
ChannelFuture fut;
if (channel.isOpen()) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/34f1e13f/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoConnector.java
----------------------------------------------------------------------
diff --git a/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoConnector.java b/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoConnector.java
index ebced0d..c485790 100644
--- a/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoConnector.java
+++ b/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoConnector.java
@@ -55,17 +55,18 @@ public class NettyIoConnector extends NettyIoService implements IoConnector {
this.handler = handler;
channelGroup = new DefaultChannelGroup("sshd-connector-channels", GlobalEventExecutor.INSTANCE);
bootstrap.group(factory.eventLoopGroup)
- .channel(NioSocketChannel.class)
- .option(ChannelOption.SO_BACKLOG, 100)
- .handler(new ChannelInitializer<SocketChannel>() {
- @Override
- protected void initChannel(SocketChannel ch) throws Exception {
- NettyIoSession session = new NettyIoSession(NettyIoConnector.this, handler);
- ChannelPipeline p = ch.pipeline();
- p.addLast(new LoggingHandler(LogLevel.INFO));
- p.addLast(session.adapter);
- }
- });
+ .channel(NioSocketChannel.class)
+ .option(ChannelOption.SO_BACKLOG, 100) // TODO make this configurable
+ .handler(new ChannelInitializer<SocketChannel>() {
+ @Override
+ protected void initChannel(SocketChannel ch) throws Exception {
+ @SuppressWarnings("resource")
+ NettyIoSession session = new NettyIoSession(NettyIoConnector.this, handler);
+ ChannelPipeline p = ch.pipeline();
+ p.addLast(new LoggingHandler(LogLevel.INFO)); // TODO make this configurable
+ p.addLast(session.adapter);
+ }
+ });
}
@Override
@@ -98,18 +99,19 @@ public class NettyIoConnector extends NettyIoService implements IoConnector {
@Override
public IoSession getSession() {
Object v = getValue();
- return v instanceof IoSession ? (IoSession) v : null;
+ return (v instanceof IoSession) ? (IoSession) v : null;
}
@Override
public Throwable getException() {
Object v = getValue();
- return v instanceof Throwable ? (Throwable) v : null;
+ return (v instanceof Throwable) ? (Throwable) v : null;
}
@Override
public boolean isConnected() {
- return getValue() instanceof IoSession;
+ Object v = getValue();
+ return v instanceof IoSession;
}
@Override
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/34f1e13f/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoServiceFactory.java
----------------------------------------------------------------------
diff --git a/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoServiceFactory.java b/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoServiceFactory.java
index 2bc3f97..f65989b 100644
--- a/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoServiceFactory.java
+++ b/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoServiceFactory.java
@@ -28,6 +28,7 @@ import org.apache.sshd.common.util.closeable.AbstractCloseable;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.util.concurrent.Future;
/**
* @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
@@ -43,7 +44,7 @@ public class NettyIoServiceFactory extends AbstractCloseable implements IoServic
}
public NettyIoServiceFactory(EventLoopGroup group) {
- this.eventLoopGroup = group != null ? group : new NioEventLoopGroup();
+ this.eventLoopGroup = (group != null) ? group : new NioEventLoopGroup();
this.closeEventLoopGroup = group == null;
}
@@ -60,7 +61,8 @@ public class NettyIoServiceFactory extends AbstractCloseable implements IoServic
@Override
protected CloseFuture doCloseGracefully() {
if (closeEventLoopGroup) {
- eventLoopGroup.shutdownGracefully().addListener(fut -> closeFuture.setClosed());
+ Future<?> shutdownFuture = eventLoopGroup.shutdownGracefully();
+ shutdownFuture.addListener(fut -> closeFuture.setClosed());
} else {
closeFuture.setClosed();
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/34f1e13f/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoSession.java
----------------------------------------------------------------------
diff --git a/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoSession.java b/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoSession.java
index 57aecc6..f5864df 100644
--- a/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoSession.java
+++ b/sshd-netty/src/main/java/org/apache/sshd/netty/NettyIoSession.java
@@ -36,11 +36,13 @@ import org.apache.sshd.common.util.closeable.AbstractCloseable;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
+import io.netty.util.Attribute;
/**
* The Netty based IoSession implementation.
@@ -73,22 +75,30 @@ public class NettyIoSession extends AbstractCloseable implements IoSession {
@Override
public Object getAttribute(Object key) {
- return attributes.get(key);
+ synchronized (attributes) {
+ return attributes.get(key);
+ }
}
@Override
public Object setAttribute(Object key, Object value) {
- return attributes.put(key, value);
+ synchronized (attributes) {
+ return attributes.put(key, value);
+ }
}
@Override
public Object setAttributeIfAbsent(Object key, Object value) {
- return attributes.putIfAbsent(key, value);
+ synchronized (attributes) {
+ return attributes.putIfAbsent(key, value);
+ }
}
@Override
public Object removeAttribute(Object key) {
- return attributes.remove(key);
+ synchronized (attributes) {
+ return attributes.remove(key);
+ }
}
@Override
@@ -98,13 +108,15 @@ public class NettyIoSession extends AbstractCloseable implements IoSession {
@Override
public SocketAddress getLocalAddress() {
- return context.channel().localAddress();
+ Channel channel = context.channel();
+ return channel.localAddress();
}
@Override
public IoWriteFuture writePacket(Buffer buffer) {
- ByteBuf buf = Unpooled.buffer(buffer.available());
- buf.writeBytes(buffer.array(), buffer.rpos(), buffer.available());
+ int bufLen = buffer.available();
+ ByteBuf buf = Unpooled.buffer(bufLen);
+ buf.writeBytes(buffer.array(), buffer.rpos(), bufLen);
DefaultIoWriteFuture msg = new DefaultIoWriteFuture(getRemoteAddress(), null);
ChannelPromise next = context.newPromise();
prev.addListener(whatever -> {
@@ -130,11 +142,9 @@ public class NettyIoSession extends AbstractCloseable implements IoSession {
@Override
protected CloseFuture doCloseGracefully() {
- context.writeAndFlush(Unpooled.EMPTY_BUFFER).
- addListener(ChannelFutureListener.CLOSE).
- addListener(fut -> {
- closeFuture.setClosed();
- });
+ context.writeAndFlush(Unpooled.EMPTY_BUFFER)
+ .addListener(ChannelFutureListener.CLOSE)
+ .addListener(fut -> closeFuture.setClosed());
return closeFuture;
}
@@ -146,12 +156,15 @@ public class NettyIoSession extends AbstractCloseable implements IoSession {
protected void channelActive(ChannelHandlerContext ctx) throws Exception {
context = ctx;
- service.channelGroup.add(ctx.channel());
+ Channel channel = ctx.channel();
+ service.channelGroup.add(channel);
service.sessions.put(id, NettyIoSession.this);
prev = context.newPromise().setSuccess();
- remoteAddr = context.channel().remoteAddress();
+ remoteAddr = channel.remoteAddress();
handler.sessionCreated(NettyIoSession.this);
- IoConnectFuture future = ctx.channel().attr(NettyIoService.CONNECT_FUTURE_KEY).get();
+
+ Attribute<IoConnectFuture> connectFuture = channel.attr(NettyIoService.CONNECT_FUTURE_KEY);
+ IoConnectFuture future = connectFuture.get();
if (future != null) {
future.setSession(NettyIoSession.this);
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/34f1e13f/sshd-netty/src/main/java/org/apache/sshd/netty/NettySupport.java
----------------------------------------------------------------------
diff --git a/sshd-netty/src/main/java/org/apache/sshd/netty/NettySupport.java b/sshd-netty/src/main/java/org/apache/sshd/netty/NettySupport.java
index 9f9de89..3f4d746 100644
--- a/sshd-netty/src/main/java/org/apache/sshd/netty/NettySupport.java
+++ b/sshd-netty/src/main/java/org/apache/sshd/netty/NettySupport.java
@@ -22,13 +22,17 @@ import org.apache.sshd.common.util.Readable;
import io.netty.buffer.ByteBuf;
+/**
+ * @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
public final class NettySupport {
private NettySupport() {
throw new UnsupportedOperationException("No instance allowed");
}
- public static Readable asReadable(final ByteBuf buffer) {
+ public static Readable asReadable(ByteBuf buffer) {
return new Readable() {
@Override
public int available() {
@@ -41,5 +45,4 @@ public final class NettySupport {
}
};
}
-
}
[5/5] mina-sshd git commit: [SSHD-817] Updated README.md about using
Netty I/O provider
Posted by lg...@apache.org.
[SSHD-817] Updated README.md about using Netty I/O provider
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/ec9c0d8d
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/ec9c0d8d
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/ec9c0d8d
Branch: refs/heads/master
Commit: ec9c0d8d07ded405bcbf51f572bedbb932f0348a
Parents: 32d2d05
Author: Lyor Goldstein <ly...@gmail.com>
Authored: Thu Apr 19 11:27:52 2018 +0300
Committer: Lyor Goldstein <ly...@gmail.com>
Committed: Thu Apr 19 11:36:20 2018 +0300
----------------------------------------------------------------------
README.md | 40 ++++++++++++++++++++++++++++++++--------
1 file changed, 32 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ec9c0d8d/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 4878117..f512a3f 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,10 @@ Apache SSHD is a 100% pure java library to support the SSH protocols on both the
The code only requires the core abstract [slf4j-api](https://mvnrepository.com/artifact/org.slf4j/slf4j-api) module. The actual implementation of the logging API can be selected from the many existing adaptors.
+# Optional dependencies
-* [Bouncy Castle](https://www.bouncycastle.org/)
+
+## [Bouncy Castle](https://www.bouncycastle.org/)
Required mainly for writing keys to PEM files or for special keys/ciphers/etc. that are not part of the standard [Java Cryptography Extension](https://en.wikipedia.org/wiki/Java_Cryptography_Extension). See [Java Cryptography Architecture (JCA) Reference Guide](https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec.html) for key classes and explanations as to how _Bouncy Castle_ is plugged in (other security providers).
@@ -48,11 +50,14 @@ Required mainly for writing keys to PEM files or for special keys/ciphers/etc. t
```
-* [MINA core](https://mina.apache.org/mina-project/)
-
+## NIO2 default socket factory replacements
-Optional dependency to enable choosing between NIO asynchronous sockets (the default - for improved performance), and "legacy" sockets. See `IoServiceFactoryFactory` implementations and specifically the `DefaultIoServiceFactoryFactory` for the available options and how it can be configured to select among them. **Note:** the required Maven module(s) are defined as `optional` so must be added as an **explicit** dependency in order to be included in the classpath:
+Optional dependency to enable choosing between NIO asynchronous sockets (the default - for improved performance), and "legacy" sockets.
+See `IoServiceFactoryFactory` implementations and specifically the `DefaultIoServiceFactoryFactory` for the available options and how it
+can be configured to select among them. **Note:** the required Maven module(s) are defined as `optional` so must be added as an **explicit**
+dependency in order to be included in the classpath.
+### [MINA core](https://mina.apache.org/mina-project/)
```xml
@@ -63,22 +68,41 @@ Optional dependency to enable choosing between NIO asynchronous sockets (the def
<version>2.0.17</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.sshd</groupId>
+ <artifactId>sshd-mina</artifactId>
+ <version>...same as sshd-core...</version>
+ </dependency>
+
```
-**NOTE:** in order to use this library one must also add the `sshd-mina` artifact
+### [Netty](https://netty.io/)
+
+Another a NIO client server framework option that can be used as a replacement for the default NIO asynchronous sockets core
+implementation. This is also an **optional** dependency and must be add explicitly via the `sshd-netty` artifact.
```xml
<dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-transport</artifactId>
+ <version>...Netty version...</version>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-handler</artifactId>
+ <version>...Netty version...</version>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.sshd</groupId>
- <artifactId>sshd-mina</artifactId>
+ <artifactId>sshd-netty</artifactId>
<version>...same as sshd-core...</version>
</dependency>
```
-
-* [ed25519-java](https://github.com/str4d/ed25519-java)
+## [ed25519-java](https://github.com/str4d/ed25519-java)
Required for supporting [ssh-ed25519](https://tools.ietf.org/html/draft-bjh21-ssh-ed25519-02) keys and [ed25519-sha-512](https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-02) signatures. **Note:** the required Maven module(s) are defined as `optional` so must be added as an **explicit** dependency in order to be included in the classpath:
[3/5] mina-sshd git commit: [SSHD-817] Invert dependency between
Netty and SFTP modules
Posted by lg...@apache.org.
[SSHD-817] Invert dependency between Netty and SFTP modules
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/229d6f38
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/229d6f38
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/229d6f38
Branch: refs/heads/master
Commit: 229d6f38583807036a0d1c9834ee9fc828cd9979
Parents: 598c991
Author: Lyor Goldstein <ly...@gmail.com>
Authored: Thu Apr 19 10:58:29 2018 +0300
Committer: Lyor Goldstein <ly...@gmail.com>
Committed: Thu Apr 19 11:36:19 2018 +0300
----------------------------------------------------------------------
sshd-core/.gitignore | 3 ++-
sshd-git/pom.xml | 40 ++++++++++++++++++++++++++++++++++++++++
sshd-mina/.gitignore | 3 +++
sshd-netty/.gitignore | 3 +++
sshd-netty/pom.xml | 17 ++++-------------
sshd-sftp/pom.xml | 40 ++++++++++++++++++++++++++++++++++++++++
6 files changed, 92 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/229d6f38/sshd-core/.gitignore
----------------------------------------------------------------------
diff --git a/sshd-core/.gitignore b/sshd-core/.gitignore
index d23a014..d38c903 100644
--- a/sshd-core/.gitignore
+++ b/sshd-core/.gitignore
@@ -1,2 +1,3 @@
key.pem
-key.ser
\ No newline at end of file
+key.ser
+hostkey.ser
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/229d6f38/sshd-git/pom.xml
----------------------------------------------------------------------
diff --git a/sshd-git/pom.xml b/sshd-git/pom.xml
index 529744f..4cf0873 100644
--- a/sshd-git/pom.xml
+++ b/sshd-git/pom.xml
@@ -167,5 +167,45 @@
</plugins>
</build>
</profile>
+
+ <profile>
+ <id>test-netty</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.sshd</groupId>
+ <artifactId>sshd-netty</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>netty</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <reportsDirectory>${project.build.directory}/surefire-reports-netty</reportsDirectory>
+ <systemProperties>
+ <org.apache.sshd.common.io.IoServiceFactoryFactory>org.apache.sshd.netty.NettyIoServiceFactoryFactory</org.apache.sshd.common.io.IoServiceFactoryFactory>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/229d6f38/sshd-mina/.gitignore
----------------------------------------------------------------------
diff --git a/sshd-mina/.gitignore b/sshd-mina/.gitignore
new file mode 100644
index 0000000..d38c903
--- /dev/null
+++ b/sshd-mina/.gitignore
@@ -0,0 +1,3 @@
+key.pem
+key.ser
+hostkey.ser
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/229d6f38/sshd-netty/.gitignore
----------------------------------------------------------------------
diff --git a/sshd-netty/.gitignore b/sshd-netty/.gitignore
new file mode 100644
index 0000000..d38c903
--- /dev/null
+++ b/sshd-netty/.gitignore
@@ -0,0 +1,3 @@
+key.pem
+key.ser
+hostkey.ser
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/229d6f38/sshd-netty/pom.xml
----------------------------------------------------------------------
diff --git a/sshd-netty/pom.xml b/sshd-netty/pom.xml
index fdb0f3e..d48fc30 100644
--- a/sshd-netty/pom.xml
+++ b/sshd-netty/pom.xml
@@ -64,12 +64,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.sshd</groupId>
- <artifactId>sshd-sftp</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>net.i2p.crypto</groupId>
<artifactId>eddsa</artifactId>
<scope>test</scope>
@@ -127,10 +121,10 @@
</dependencies>
<build>
- <testSourceDirectory>${build.directory}/test-sources</testSourceDirectory>
+ <testSourceDirectory>${project.build.directory}/test-sources</testSourceDirectory>
<testResources>
<testResource>
- <directory>${build.directory}/test-resources</directory>
+ <directory>${project.build.directory}/test-resources</directory>
</testResource>
</testResources>
<plugins>
@@ -145,7 +139,7 @@
<goal>copy-resources</goal>
</goals>
<configuration>
- <outputDirectory>${build.directory}/test-resources</outputDirectory>
+ <outputDirectory>${project.build.directory}/test-resources</outputDirectory>
<resources>
<resource>
<directory>${projectRoot}/sshd-core/src/test/resources</directory>
@@ -160,7 +154,7 @@
<goal>copy-resources</goal>
</goals>
<configuration>
- <outputDirectory>${build.directory}/test-sources</outputDirectory>
+ <outputDirectory>${project.build.directory}/test-sources</outputDirectory>
<resources>
<resource>
<directory>${projectRoot}/sshd-core/src/test/java</directory>
@@ -170,9 +164,6 @@
<exclude>**/PortForwardingLoadTest.java</exclude>
</excludes>
</resource>
- <resource>
- <directory>${projectRoot}/sshd-sftp/src/test/java</directory>
- </resource>
</resources>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/229d6f38/sshd-sftp/pom.xml
----------------------------------------------------------------------
diff --git a/sshd-sftp/pom.xml b/sshd-sftp/pom.xml
index e36d6ba..e2578f0 100644
--- a/sshd-sftp/pom.xml
+++ b/sshd-sftp/pom.xml
@@ -152,5 +152,45 @@
</plugins>
</build>
</profile>
+
+ <profile>
+ <id>test-netty</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.sshd</groupId>
+ <artifactId>sshd-netty</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>netty</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <reportsDirectory>${project.build.directory}/surefire-reports-netty</reportsDirectory>
+ <systemProperties>
+ <org.apache.sshd.common.io.IoServiceFactoryFactory>org.apache.sshd.netty.NettyIoServiceFactoryFactory</org.apache.sshd.common.io.IoServiceFactoryFactory>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
[4/5] mina-sshd git commit: Fixed some Javadoc malformed documentation
Posted by lg...@apache.org.
Fixed some Javadoc malformed documentation
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/32d2d053
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/32d2d053
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/32d2d053
Branch: refs/heads/master
Commit: 32d2d05310c7c852fc2b2fc5e8827ae258614f7c
Parents: 66432b0
Author: Lyor Goldstein <ly...@gmail.com>
Authored: Thu Apr 19 11:16:20 2018 +0300
Committer: Lyor Goldstein <ly...@gmail.com>
Committed: Thu Apr 19 11:36:20 2018 +0300
----------------------------------------------------------------------
.../common/config/keys/AuthorizedKeyEntry.java | 8 +++---
.../sshd/common/util/logging/LoggingUtils.java | 12 ++++++++
.../java/org/apache/sshd/KeyReExchangeTest.java | 6 +++-
.../java/org/apache/sshd/client/ClientTest.java | 30 --------------------
.../forward/ConcurrentConnectionTest.java | 4 +--
.../apache/sshd/git/GitLocationResolver.java | 2 +-
.../git/transport/GitSshdSessionFactory.java | 2 +-
.../subsystem/sftp/SftpClientFactory.java | 5 ++--
.../sshd/common/subsystem/sftp/SftpHelper.java | 4 +--
9 files changed, 30 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/32d2d053/sshd-core/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java
index 6d90d30..a763903 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java
@@ -348,13 +348,13 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* Parses a single line from an <code>authorized_keys</code> file that is <U>known</U>
* to contain login options and separates it to the options and the rest of the line.
*
- * @param line The line to be parsed
+ * @param entryLine The line to be parsed
* @return A {@link SimpleImmutableEntry} representing the parsed data where key=login options part
* and value=rest of the data - {@code null} if no data in line or line starts with comment character
* @see <A HREF="http://man.openbsd.org/sshd.8#AUTHORIZED_KEYS_FILE_FORMAT">sshd(8) - AUTHORIZED_KEYS_FILE_FORMAT</A>
*/
- public static SimpleImmutableEntry<String, String> resolveEntryComponents(String value) {
- String line = GenericUtils.replaceWhitespaceAndTrim(value);
+ public static SimpleImmutableEntry<String, String> resolveEntryComponents(String entryLine) {
+ String line = GenericUtils.replaceWhitespaceAndTrim(entryLine);
if (GenericUtils.isEmpty(line) || (line.charAt(0) == COMMENT_CHAR) /* comment ? */) {
return null;
}
@@ -403,7 +403,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* </UL>
*
* @param options The options line to parse - ignored if {@code null}/empty/blank
- * @param A {@link NavigableMap} where key=case <U>insensitive</U> option name and value=the parsed value.
+ * @return A {@link NavigableMap} where key=case <U>insensitive</U> option name and value=the parsed value.
* @see #addLoginOption(Map, String) addLoginOption
*/
public static NavigableMap<String, String> parseLoginOptions(String options) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/32d2d053/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
index 16fe6d1..7674471 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
@@ -314,6 +314,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @param level The log {@link Level} mapped as follows:</BR>
*
@@ -351,6 +352,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @return A consumer whose {@link Consumer#accept(Object)} method logs nothing when invoked
*/
@@ -360,6 +362,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @return A consumer whose {@link Consumer#accept(Object)} method logs the
* {@link String#valueOf(Object)} value of its argument if {@link Logger#isErrorEnabled()}
@@ -369,6 +372,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @param thrown A {@link Throwable} to attach to the message - ignored if {@code null}
* @return A consumer whose {@link Consumer#accept(Object)} method logs the
@@ -397,6 +401,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @return A consumer whose {@link Consumer#accept(Object)} method logs the
* {@link String#valueOf(Object)} value of its argument if {@link Logger#isWarnEnabled()}
@@ -406,6 +411,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @param thrown A {@link Throwable} to attach to the message - ignored if {@code null}
* @return A consumer whose {@link Consumer#accept(Object)} method logs the {@link String#valueOf(Object)}
@@ -434,6 +440,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @return A consumer whose {@link Consumer#accept(Object)} method logs the {@link String#valueOf(Object)}
* value of its argument if {@link Logger#isInfoEnabled()}
@@ -443,6 +450,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @param thrown A {@link Throwable} to attach to the message - ignored if {@code null}
* @return A consumer whose {@link Consumer#accept(Object)} method logs the
@@ -471,6 +479,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @return A consumer whose {@link Consumer#accept(Object)} method logs the
* {@link String#valueOf(Object)} value of its argument if {@link Logger#isDebugEnabled()}
@@ -480,6 +489,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @param thrown A {@link Throwable} to attach to the message - ignored if {@code null}
* @return A consumer whose {@link Consumer#accept(Object)} method logs the
@@ -508,6 +518,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @return A consumer whose {@link Consumer#accept(Object)} method logs the
* {@link String#valueOf(Object)} value of its argument if {@link Logger#isTraceEnabled()}
@@ -517,6 +528,7 @@ public final class LoggingUtils {
}
/**
+ * @param <T> Generic message type consumer
* @param logger The {@link Logger} instance to use
* @param thrown A {@link Throwable} to attach to the message - ignored if {@code null}
* @return A consumer whose {@link Consumer#accept(Object)} method logs the
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/32d2d053/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java b/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
index 63c2787..f2ca9df 100644
--- a/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/KeyReExchangeTest.java
@@ -664,10 +664,14 @@ public class KeyReExchangeTest extends BaseTestSupport {
}
}
- private static class TestSubsystemFactory implements SubsystemFactory {
+ static class TestSubsystemFactory implements SubsystemFactory {
public static final String NAME = "test-subsystem";
+ TestSubsystemFactory() {
+ super();
+ }
+
@Override
public Command create() {
return new Command() {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/32d2d053/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
index 3d03e8e..67a5f57 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
@@ -75,7 +75,6 @@ import org.apache.sshd.common.SshConstants;
import org.apache.sshd.common.SshException;
import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.channel.ChannelListener;
-import org.apache.sshd.common.channel.ChannelListenerManager;
import org.apache.sshd.common.config.keys.KeyUtils;
import org.apache.sshd.common.future.CloseFuture;
import org.apache.sshd.common.future.SshFutureListener;
@@ -113,7 +112,6 @@ import org.apache.sshd.util.test.BaseTestSupport;
import org.apache.sshd.util.test.EchoShell;
import org.apache.sshd.util.test.EchoShellFactory;
import org.apache.sshd.util.test.TeeOutputStream;
-import org.apache.sshd.util.test.TestChannelListener;
import org.junit.After;
import org.junit.Before;
import org.junit.FixMethodOrder;
@@ -1418,34 +1416,6 @@ public class ClientTest extends BaseTestSupport {
}
}
- private static void assertListenerSizes(String phase, Map<String, ? extends TestChannelListener> listeners, int activeSize, int openSize) {
- assertListenerSizes(phase, listeners.values(), activeSize, openSize);
- }
-
- private static void assertListenerSizes(String phase, Collection<? extends TestChannelListener> listeners, int activeSize, int openSize) {
- if (GenericUtils.isEmpty(listeners)) {
- return;
- }
-
- for (TestChannelListener l : listeners) {
- if (activeSize >= 0) {
- assertEquals(phase + ": mismatched active channels size for " + l.getName() + " listener", activeSize, GenericUtils.size(l.getActiveChannels()));
- }
-
- if (openSize >= 0) {
- assertEquals(phase + ": mismatched open channels size for " + l.getName() + " listener", openSize, GenericUtils.size(l.getOpenChannels()));
- }
-
- assertEquals(phase + ": unexpected failed channels size for " + l.getName() + " listener", 0, GenericUtils.size(l.getFailedChannels()));
- }
- }
-
- private static <L extends ChannelListener & NamedResource> void addChannelListener(Map<String, L> listeners, ChannelListenerManager manager, L listener) {
- String name = listener.getName();
- assertNull("Duplicate listener named " + name, listeners.put(name, listener));
- manager.addChannelListener(listener);
- }
-
private ClientSession createTestClientSession() throws IOException {
ClientSession session = createTestClientSession(TEST_LOCALHOST);
try {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/32d2d053/sshd-core/src/test/java/org/apache/sshd/common/forward/ConcurrentConnectionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/forward/ConcurrentConnectionTest.java b/sshd-core/src/test/java/org/apache/sshd/common/forward/ConcurrentConnectionTest.java
index 89a282c..2bf6932 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/forward/ConcurrentConnectionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/forward/ConcurrentConnectionTest.java
@@ -175,7 +175,7 @@ public class ConcurrentConnectionTest extends BaseTestSupport {
@Test
/*
* Run PORT_FORWARD_CLIENT_COUNT simultaneous server threads.
- *
+ *
* Emulates a web browser making a number of simultaneous requests on
* different connections to the same server HTTP specifies no more than two,
* but most modern browsers do 6 or more.
@@ -227,7 +227,7 @@ public class ConcurrentConnectionTest extends BaseTestSupport {
assertEquals("Not all clients succeeded", PORT_FORWARD_CLIENT_COUNT, success.get());
}
- /**
+ /*
* Send PAYLOAD_TO_SERVER to the server, then read PAYLOAD_TO_CLIENT from
* server. Emulates a web browser making a request
*/
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/32d2d053/sshd-git/src/main/java/org/apache/sshd/git/GitLocationResolver.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/main/java/org/apache/sshd/git/GitLocationResolver.java b/sshd-git/src/main/java/org/apache/sshd/git/GitLocationResolver.java
index 323807f..115d4fa 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/GitLocationResolver.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/GitLocationResolver.java
@@ -48,7 +48,7 @@ public interface GitLocationResolver {
/**
* Creates a resolver that returns the same root directory for any invocation of
- * {@link #resolveRootDirectory(String, ServerSession, FileSystem) resolveRootDirectory}
+ * {@link #resolveRootDirectory(String, String[], ServerSession, FileSystem) resolveRootDirectory}
*
* @param rootDir The (never {@code null}) root directory to return
* @return The wrapper resolver
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/32d2d053/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSessionFactory.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSessionFactory.java b/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSessionFactory.java
index bd429e5..75281c5 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSessionFactory.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/transport/GitSshdSessionFactory.java
@@ -63,7 +63,7 @@ public class GitSshdSessionFactory extends SshSessionFactory implements ClientSe
* <B>Note:</B> in this case, the connection and authentication phase are <U>skipped</U> - i.e.,
* any specific host/port/user/password(s) specified in the GIT URI are <U>not used</U>.
*
- * @param client The (never {@code null}) client instance
+ * @param session The (never {@code null}) client session instance
*/
public GitSshdSessionFactory(ClientSession session) {
this(null, session);
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/32d2d053/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClientFactory.java
----------------------------------------------------------------------
diff --git a/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClientFactory.java b/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClientFactory.java
index 7f79b33..5497c91 100644
--- a/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClientFactory.java
+++ b/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClientFactory.java
@@ -38,6 +38,7 @@ public interface SftpClientFactory {
/**
* Create an SFTP client from this session.
*
+ * @param session The {@link ClientSession} to be used for creating the SFTP client
* @return The created {@link SftpClient}
* @throws IOException if failed to create the client
*/
@@ -48,9 +49,9 @@ public interface SftpClientFactory {
/**
* Creates an SFTP client using the specified version
*
+ * @param session The {@link ClientSession} to be used for creating the SFTP client
* @param version The version to use - <B>Note:</B> if the specified
- * version is not supported by the server then an exception
- * will occur
+ * version is not supported by the server then an exception will occur
* @return The created {@link SftpClient}
* @throws IOException If failed to create the client or use the specified version
*/
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/32d2d053/sshd-sftp/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
----------------------------------------------------------------------
diff --git a/sshd-sftp/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java b/sshd-sftp/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
index 9404e1e..90cdfad 100644
--- a/sshd-sftp/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
+++ b/sshd-sftp/src/main/java/org/apache/sshd/common/subsystem/sftp/SftpHelper.java
@@ -70,7 +70,7 @@ import org.apache.sshd.server.subsystem.sftp.UnixDateFormat;
public final class SftpHelper {
/**
* Used to control whether to append the end-of-list indicator for
- * SSH_FXP_NAME responses via {@link #indicateEndOfNamesList(Buffer, int, PropertyResolver, Boolean)}
+ * SSH_FXP_NAME responses via {@link #indicateEndOfNamesList(Buffer, int, PropertyResolver, boolean)}
* call, as indicated by <A HREF="https://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.4">SFTP v6 - section 9.4</A>
*/
public static final String APPEND_END_OF_LIST_INDICATOR = "sftp-append-eol-indicator";
@@ -146,7 +146,7 @@ public final class SftpHelper {
* @param version The SFTP version being used
* @return The indicator value - {@code null} if none retrieved
* @see <A HREF="https://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.4">SFTP v6 - section 9.4</A>
- * @see #indicateEndOfNamesList(Buffer, int, PropertyResolver, Boolean)
+ * @see #indicateEndOfNamesList(Buffer, int, PropertyResolver, boolean)
*/
public static Boolean getEndOfListIndicatorValue(Buffer buffer, int version) {
return (version < SftpConstants.SFTP_V6) || (buffer.available() < 1) ? null : buffer.getBoolean();