From commits-return-11690-archive-asf-public=cust-asf.ponee.io@mina.apache.org Thu Oct 25 11:11:02 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3D1641807A5 for ; Thu, 25 Oct 2018 11:10:59 +0200 (CEST) Received: (qmail 57484 invoked by uid 500); 25 Oct 2018 09:10:58 -0000 Mailing-List: contact commits-help@mina.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mina.apache.org Delivered-To: mailing list commits@mina.apache.org Received: (qmail 57267 invoked by uid 99); 25 Oct 2018 09:10:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Oct 2018 09:10:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 76D67E10D4; Thu, 25 Oct 2018 09:10:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lgoldstein@apache.org To: commits@mina.apache.org Date: Thu, 25 Oct 2018 09:11:04 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [8/9] mina-sshd git commit: A few minor code style indentations fixes to try and break long lines http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java index 96460d8..56e397f 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthService.java @@ -71,7 +71,7 @@ public class ClientUserAuthService public ClientUserAuthService(Session s) { clientSession = ValidateUtils.checkInstanceOf(s, ClientSessionImpl.class, "Client side service used on server side: %s", s); authFactories = ValidateUtils.checkNotNullAndNotEmpty( - clientSession.getUserAuthFactories(), "No user auth factories for %s", s); + clientSession.getUserAuthFactories(), "No user auth factories for %s", s); clientMethods = new ArrayList<>(); String prefs = s.getString(ClientAuthenticationManager.PREFERRED_AUTHS); @@ -86,7 +86,8 @@ public class ClientUserAuthService } for (String pref : GenericUtils.split(prefs, ',')) { - NamedFactory factory = NamedResource.findByName(pref, String.CASE_INSENSITIVE_ORDER, authFactories); + NamedFactory factory = + NamedResource.findByName(pref, String.CASE_INSENSITIVE_ORDER, authFactories); if (factory != null) { clientMethods.add(pref); } else { @@ -151,7 +152,8 @@ public class ClientUserAuthService } String username = session.getUsername(); - Buffer buffer = session.createBuffer(SshConstants.SSH_MSG_USERAUTH_REQUEST, username.length() + service.length() + Integer.SIZE); + Buffer buffer = session.createBuffer(SshConstants.SSH_MSG_USERAUTH_REQUEST, + username.length() + service.length() + Integer.SIZE); buffer.putString(username); buffer.putString(service); buffer.putString("none"); @@ -167,13 +169,13 @@ public class ClientUserAuthService boolean debugEnabled = log.isDebugEnabled(); if ((authFuture != null) && authFuture.isSuccess()) { log.error("process({}) unexpected authenticated client command: {}", - session, SshConstants.getCommandMessageName(cmd)); + session, SshConstants.getCommandMessageName(cmd)); throw new IllegalStateException("UserAuth message delivered to authenticated client"); } else if ((authFuture != null) && authFuture.isDone()) { // ignore for now; TODO: random packets if (debugEnabled) { log.debug("process({}) Ignoring random message - cmd={}", - session, SshConstants.getCommandMessageName(cmd)); + session, SshConstants.getCommandMessageName(cmd)); } } else if (cmd == SshConstants.SSH_MSG_USERAUTH_BANNER) { String welcome = buffer.getString(); @@ -189,7 +191,7 @@ public class ClientUserAuthService } } catch (Error e) { log.warn("process({}) failed ({}) to consult interaction: {}", - session, e.getClass().getSimpleName(), e.getMessage()); + session, e.getClass().getSimpleName(), e.getMessage()); if (debugEnabled) { log.debug("process(" + session + ") interaction consultation failure details", e); } @@ -214,7 +216,7 @@ public class ClientUserAuthService if (cmd == SshConstants.SSH_MSG_USERAUTH_SUCCESS) { if (log.isDebugEnabled()) { log.debug("processUserAuth({}) SSH_MSG_USERAUTH_SUCCESS Succeeded with {}", - session, (userAuth == null) ? "" : userAuth.getName()); + session, (userAuth == null) ? "" : userAuth.getName()); } if (userAuth != null) { try { @@ -237,7 +239,7 @@ public class ClientUserAuthService boolean partial = buffer.getBoolean(); if (log.isDebugEnabled()) { log.debug("processUserAuth({}) Received SSH_MSG_USERAUTH_FAILURE - partial={}, methods={}", - session, partial, mths); + session, partial, mths); } if (partial || (serverMethods == null)) { serverMethods = Arrays.asList(GenericUtils.split(mths, ',')); @@ -261,7 +263,7 @@ public class ClientUserAuthService if (log.isDebugEnabled()) { log.debug("processUserAuth({}) delegate processing of {} to {}", - session, SshConstants.getCommandMessageName(cmd), userAuth.getName()); + session, SshConstants.getCommandMessageName(cmd), userAuth.getName()); } buffer.rpos(buffer.rpos() - 1); @@ -278,7 +280,7 @@ public class ClientUserAuthService if (userAuth == null) { if (debugEnabled) { log.debug("tryNext({}) starting authentication mechanisms: client={}, server={}", - session, clientMethods, serverMethods); + session, clientMethods, serverMethods); } } else if (!userAuth.process(null)) { if (debugEnabled) { @@ -310,12 +312,13 @@ public class ClientUserAuthService if (currentMethod >= clientMethods.size()) { if (debugEnabled) { log.debug("tryNext({}) exhausted all methods - client={}, server={}", - session, clientMethods, serverMethods); + session, clientMethods, serverMethods); } // also wake up anyone sitting in waitFor AuthFuture authFuture = Objects.requireNonNull(authFutureHolder.get(), "No current future"); - authFuture.setException(new SshException(SshConstants.SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE, "No more authentication methods available")); + authFuture.setException(new SshException( + SshConstants.SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE, "No more authentication methods available")); return; } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java b/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java index 0def8b4..bce2283 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/BaseBuilder.java @@ -69,20 +69,21 @@ public class BaseBuilderssh_config(5) */ public static final List DEFAULT_CIPHERS_PREFERENCE = - Collections.unmodifiableList(Arrays.asList( - BuiltinCiphers.aes128ctr, - BuiltinCiphers.aes192ctr, - BuiltinCiphers.aes256ctr, - BuiltinCiphers.arcfour256, - BuiltinCiphers.arcfour128, - BuiltinCiphers.aes128cbc, - BuiltinCiphers.tripledescbc, - BuiltinCiphers.blowfishcbc, - // TODO add support for cast128-cbc cipher - BuiltinCiphers.aes192cbc, - BuiltinCiphers.aes256cbc - // TODO add support for arcfour cipher - )); + Collections.unmodifiableList( + Arrays.asList( + BuiltinCiphers.aes128ctr, + BuiltinCiphers.aes192ctr, + BuiltinCiphers.aes256ctr, + BuiltinCiphers.arcfour256, + BuiltinCiphers.arcfour128, + BuiltinCiphers.aes128cbc, + BuiltinCiphers.tripledescbc, + BuiltinCiphers.blowfishcbc, + // TODO add support for cast128-cbc cipher + BuiltinCiphers.aes192cbc, + BuiltinCiphers.aes256cbc + // TODO add support for arcfour cipher + )); /** * The default {@link BuiltinDHFactories} setup in order of preference @@ -90,22 +91,23 @@ public class BaseBuilder */ public static final List DEFAULT_KEX_PREFERENCE = - Collections.unmodifiableList(Arrays.asList( - BuiltinDHFactories.ecdhp521, - BuiltinDHFactories.ecdhp384, - BuiltinDHFactories.ecdhp256, - - BuiltinDHFactories.dhgex256, - BuiltinDHFactories.dhgex, - - BuiltinDHFactories.dhg18_512, - BuiltinDHFactories.dhg17_512, - BuiltinDHFactories.dhg16_512, - BuiltinDHFactories.dhg15_512, - BuiltinDHFactories.dhg14_256, - BuiltinDHFactories.dhg14, - BuiltinDHFactories.dhg1 - )); + Collections.unmodifiableList( + Arrays.asList( + BuiltinDHFactories.ecdhp521, + BuiltinDHFactories.ecdhp384, + BuiltinDHFactories.ecdhp256, + + BuiltinDHFactories.dhgex256, + BuiltinDHFactories.dhgex, + + BuiltinDHFactories.dhg18_512, + BuiltinDHFactories.dhg17_512, + BuiltinDHFactories.dhg16_512, + BuiltinDHFactories.dhg15_512, + BuiltinDHFactories.dhg14_256, + BuiltinDHFactories.dhg14, + BuiltinDHFactories.dhg1 + )); /** * The default {@link BuiltinMacs} setup in order of preference @@ -113,14 +115,15 @@ public class BaseBuilder */ public static final List DEFAULT_MAC_PREFERENCE = - Collections.unmodifiableList(Arrays.asList( - BuiltinMacs.hmacmd5, - BuiltinMacs.hmacsha1, - BuiltinMacs.hmacsha256, - BuiltinMacs.hmacsha512, - BuiltinMacs.hmacsha196, - BuiltinMacs.hmacmd596 - )); + Collections.unmodifiableList( + Arrays.asList( + BuiltinMacs.hmacmd5, + BuiltinMacs.hmacsha1, + BuiltinMacs.hmacsha256, + BuiltinMacs.hmacsha512, + BuiltinMacs.hmacsha196, + BuiltinMacs.hmacmd596 + )); /** * Preferred {@link BuiltinSignatures} according to @@ -128,14 +131,15 @@ public class BaseBuilder DEFAULT_SIGNATURE_PREFERENCE = - Collections.unmodifiableList(Arrays.asList( - BuiltinSignatures.nistp256, - BuiltinSignatures.nistp384, - BuiltinSignatures.nistp521, - BuiltinSignatures.ed25519, - BuiltinSignatures.rsa, - BuiltinSignatures.dsa - )); + Collections.unmodifiableList( + Arrays.asList( + BuiltinSignatures.nistp256, + BuiltinSignatures.nistp384, + BuiltinSignatures.nistp521, + BuiltinSignatures.ed25519, + BuiltinSignatures.rsa, + BuiltinSignatures.dsa + )); public static final UnknownChannelReferenceHandler DEFAULT_UNKNOWN_CHANNEL_REFERENCE_HANDLER = DefaultUnknownChannelReferenceHandler.INSTANCE; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java index a6c11ca..0f1892c 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java @@ -120,12 +120,15 @@ public abstract class AbstractChannel this(discriminator, client, Collections.emptyList(), null); } - protected AbstractChannel(String discriminator, boolean client, Collection> handlers, CloseableExecutorService executorService) { + protected AbstractChannel(String discriminator, boolean client, + Collection> handlers, + CloseableExecutorService executorService) { super(discriminator); gracefulFuture = new DefaultCloseFuture(discriminator, lock); localWindow = new Window(this, null, client, true); remoteWindow = new Window(this, null, client, false); - channelListenerProxy = EventListenerUtils.proxyWrapper(ChannelListener.class, getClass().getClassLoader(), channelListeners); + channelListenerProxy = EventListenerUtils.proxyWrapper( + ChannelListener.class, getClass().getClassLoader(), channelListeners); executor = executorService; addRequestHandlers(handlers); } @@ -268,12 +271,12 @@ public abstract class AbstractChannel result = handler.process(this, req, wantReply, buffer); } catch (Throwable e) { log.warn("handleRequest({}) {} while {}#process({})[want-reply={}]: {}", - this, e.getClass().getSimpleName(), handler.getClass().getSimpleName(), - req, wantReply, e.getMessage()); + this, e.getClass().getSimpleName(), handler.getClass().getSimpleName(), + req, wantReply, e.getMessage()); if (debugEnabled) { log.debug("handleRequest(" + this + ") request=" + req - + "[want-reply=" + wantReply + "] processing failure details", - e); + + "[want-reply=" + wantReply + "] processing failure details", + e); } result = RequestHandler.Result.ReplyFailure; } @@ -282,7 +285,7 @@ public abstract class AbstractChannel if (RequestHandler.Result.Unsupported.equals(result)) { if (traceEnabled) { log.trace("handleRequest({})[{}#process({})[want-reply={}]]: {}", - this, handler.getClass().getSimpleName(), req, wantReply, result); + this, handler.getClass().getSimpleName(), req, wantReply, result); } } else { sendResponse(buffer, req, result, wantReply); @@ -327,8 +330,7 @@ public abstract class AbstractChannel */ protected RequestHandler.Result handleInternalRequest(String req, boolean wantReply, Buffer buffer) throws IOException { if (log.isDebugEnabled()) { - log.debug("handleInternalRequest({})[want-reply={}] unknown type: {}", - this, wantReply, req); + log.debug("handleInternalRequest({})[want-reply={}] unknown type: {}", this, wantReply, req); } return RequestHandler.Result.Unsupported; } @@ -347,8 +349,8 @@ public abstract class AbstractChannel } byte cmd = RequestHandler.Result.ReplySuccess.equals(result) - ? SshConstants.SSH_MSG_CHANNEL_SUCCESS - : SshConstants.SSH_MSG_CHANNEL_FAILURE; + ? SshConstants.SSH_MSG_CHANNEL_SUCCESS + : SshConstants.SSH_MSG_CHANNEL_FAILURE; Session session = getSession(); Buffer rsp = session.createBuffer(cmd, Integer.BYTES); rsp.putInt(recipient); @@ -434,7 +436,7 @@ public abstract class AbstractChannel } catch (Throwable err) { Throwable ignored = GenericUtils.peelException(err); log.warn("signalChannelOpenFailure({}) failed ({}) to inform listener of open failure={}: {}", - this, ignored.getClass().getSimpleName(), reason.getClass().getSimpleName(), ignored.getMessage()); + this, ignored.getClass().getSimpleName(), reason.getClass().getSimpleName(), ignored.getMessage()); if (log.isDebugEnabled()) { log.debug("doInit(" + this + ") inform listener open failure details", ignored); } @@ -467,7 +469,7 @@ public abstract class AbstractChannel } catch (Throwable err) { Throwable e = GenericUtils.peelException(err); log.warn("notifyStateChanged({})[{}] {} while signal channel state change: {}", - this, hint, e.getClass().getSimpleName(), e.getMessage()); + this, hint, e.getClass().getSimpleName(), e.getMessage()); if (log.isDebugEnabled()) { log.debug("notifyStateChanged(" + this + ")[" + hint + "] channel state signalling failure details", e); } @@ -552,13 +554,13 @@ public abstract class AbstractChannel @Override protected Closeable getInnerCloseable() { return builder() - .sequential(new GracefulChannelCloseable(), getExecutorService()) - .run(toString(), () -> { - if (service != null) { - service.unregisterChannel(AbstractChannel.this); - } - }) - .build(); + .sequential(new GracefulChannelCloseable(), getExecutorService()) + .run(toString(), () -> { + if (service != null) { + service.unregisterChannel(AbstractChannel.this); + } + }) + .build(); } public class GracefulChannelCloseable extends IoBaseCloseable { @@ -613,7 +615,8 @@ public abstract class AbstractChannel buffer.putInt(getRecipient()); try { - long timeout = channel.getLongProperty(FactoryManager.CHANNEL_CLOSE_TIMEOUT, FactoryManager.DEFAULT_CHANNEL_CLOSE_TIMEOUT); + long timeout = channel.getLongProperty( + FactoryManager.CHANNEL_CLOSE_TIMEOUT, FactoryManager.DEFAULT_CHANNEL_CLOSE_TIMEOUT); s.writePacket(buffer, timeout, TimeUnit.MILLISECONDS).addListener(future -> { if (future.isWritten()) { handleClosePacketWritten(channel, immediately); @@ -624,7 +627,7 @@ public abstract class AbstractChannel } catch (IOException e) { if (debugEnabled) { log.debug("close({})[immediately={}] {} while writing SSH_MSG_CHANNEL_CLOSE packet on channel: {}", - channel, immediately, e.getClass().getSimpleName(), e.getMessage()); + channel, immediately, e.getClass().getSimpleName(), e.getMessage()); } if (log.isTraceEnabled()) { @@ -639,7 +642,7 @@ public abstract class AbstractChannel Collection running = service.shutdownNow(); if (debugEnabled) { log.debug("close({})[immediately={}] shutdown executor service on close - running count={}", - channel, immediately, GenericUtils.size(running)); + channel, immediately, GenericUtils.size(running)); } } @@ -649,7 +652,7 @@ public abstract class AbstractChannel protected void handleClosePacketWritten(Channel channel, boolean immediately) { if (log.isDebugEnabled()) { log.debug("handleClosePacketWritten({})[immediately={}] SSH_MSG_CHANNEL_CLOSE written on channel", - channel, immediately); + channel, immediately); } if (gracefulState.compareAndSet(GracefulState.Opened, GracefulState.CloseSent)) { @@ -663,7 +666,7 @@ public abstract class AbstractChannel protected void handleClosePacketWriteFailure(Channel channel, boolean immediately, Throwable t) { if (log.isDebugEnabled()) { log.debug("handleClosePacketWriteFailure({})[immediately={}] failed ({}) to write SSH_MSG_CHANNEL_CLOSE on channel: {}", - this, immediately, t.getClass().getSimpleName(), t.getMessage()); + this, immediately, t.getClass().getSimpleName(), t.getMessage()); } if (log.isTraceEnabled()) { log.trace("handleClosePacketWriteFailure(" + channel + ") SSH_MSG_CHANNEL_CLOSE failure details", t); @@ -791,7 +794,7 @@ public abstract class AbstractChannel } if (log.isTraceEnabled()) { BufferUtils.dumpHex(getSimplifiedLogger(), BufferUtils.DEFAULT_HEXDUMP_LEVEL, "handleData(" + this + ")", - this, BufferUtils.DEFAULT_HEX_SEPARATOR, buffer.array(), buffer.rpos(), (int) len); + this, BufferUtils.DEFAULT_HEX_SEPARATOR, buffer.array(), buffer.rpos(), (int) len); } if (isEofSignalled()) { // TODO consider throwing an exception @@ -821,7 +824,7 @@ public abstract class AbstractChannel } if (log.isTraceEnabled()) { BufferUtils.dumpHex(getSimplifiedLogger(), BufferUtils.DEFAULT_HEXDUMP_LEVEL, "handleExtendedData(" + this + ")", - this, BufferUtils.DEFAULT_HEX_SEPARATOR, buffer.array(), buffer.rpos(), (int) len); + this, BufferUtils.DEFAULT_HEX_SEPARATOR, buffer.array(), buffer.rpos(), (int) len); } if (isEofSignalled()) { // TODO consider throwing an exception @@ -953,8 +956,8 @@ public abstract class AbstractChannel @SuppressWarnings("unchecked") public T setAttribute(AttributeKey key, T value) { return (T) attributes.put( - Objects.requireNonNull(key, "No key"), - Objects.requireNonNull(value, "No value")); + Objects.requireNonNull(key, "No key"), + Objects.requireNonNull(value, "No value")); } @Override http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java index 827a877..21af35e 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/PtyMode.java @@ -24,6 +24,7 @@ import java.util.Comparator; import java.util.EnumMap; import java.util.EnumSet; import java.util.Map; +import java.util.NavigableMap; import java.util.Set; import java.util.function.Function; @@ -291,11 +292,12 @@ public enum PtyMode { /** * An un-modifiable {@link Set} of all defined {@link PtyMode}s */ - public static final Set MODES = Collections.unmodifiableSet(EnumSet.allOf(PtyMode.class)); + public static final Set MODES = + Collections.unmodifiableSet(EnumSet.allOf(PtyMode.class)); - private static final Map COMMANDS = - Collections.unmodifiableMap( - GenericUtils.toSortedMap(MODES, PtyMode::toInt, Function.identity(), Comparator.naturalOrder())); + private static final NavigableMap COMMANDS = + Collections.unmodifiableNavigableMap( + GenericUtils.toSortedMap(MODES, PtyMode::toInt, Function.identity(), Comparator.naturalOrder())); private final int v; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/channel/RequestHandler.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/RequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/RequestHandler.java index d7e796f..0bba136 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/channel/RequestHandler.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/RequestHandler.java @@ -41,7 +41,7 @@ public interface RequestHandler { ReplyFailure; public static final Set VALUES = - Collections.unmodifiableSet(EnumSet.allOf(Result.class)); + Collections.unmodifiableSet(EnumSet.allOf(Result.class)); /** * @param name The result name - ignored if {@code null}/empty http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultForwardingFilter.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultForwardingFilter.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultForwardingFilter.java index a5cae0d..2644751 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultForwardingFilter.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultForwardingFilter.java @@ -90,7 +90,7 @@ public class DefaultForwardingFilter public static final long DEFAULT_FORWARD_REQUEST_TIMEOUT = TimeUnit.SECONDS.toMillis(15L); public static final Set STATIC_IO_MSG_RECEIVED_EVENTS = - Collections.unmodifiableSet(EnumSet.of(ClientChannelEvent.OPENED, ClientChannelEvent.CLOSED)); + Collections.unmodifiableSet(EnumSet.of(ClientChannelEvent.OPENED, ClientChannelEvent.CLOSED)); private final ConnectionService service; private final IoHandlerFactory socksProxyIoHandlerFactory = () -> new SocksProxy(getConnectionService()); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/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 498d61f..82d6d2f 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 @@ -57,7 +57,7 @@ public class TcpipClientChannel extends AbstractClientChannel implements Forward Forwarded("forwarded-tcpip"); public static final Set VALUES = - Collections.unmodifiableSet(EnumSet.allOf(Type.class)); + Collections.unmodifiableSet(EnumSet.allOf(Type.class)); private final String channelType; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java index 8518fad..bcb70ea 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/global/AbstractOpenSshHostKeysHandler.java @@ -71,7 +71,7 @@ public abstract class AbstractOpenSshHostKeysHandler extends AbstractConnectionS PublicKey key = buffer.getPublicKey(p); if (debugEnabled) { log.debug("process({})[{}] key type={}, fingerprint={}", - connectionService, request, KeyUtils.getKeyType(key), KeyUtils.getFingerPrint(key)); + connectionService, request, KeyUtils.getKeyType(key), KeyUtils.getFingerPrint(key)); } if (key != null) { keys.add(key); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java b/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java index da4dd90..7c437b5 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java @@ -37,7 +37,7 @@ public enum BuiltinIoServiceFactoryFactories implements NamedFactory VALUES = - Collections.unmodifiableSet(EnumSet.allOf(BuiltinIoServiceFactoryFactories.class)); + Collections.unmodifiableSet(EnumSet.allOf(BuiltinIoServiceFactoryFactories.class)); private final Class factoryClass; private final String factoryClassName; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java index aea3d19..7c19f54 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java @@ -228,10 +228,10 @@ public enum BuiltinDHFactories implements DHFactory { }; public static final Set VALUES = - Collections.unmodifiableSet(EnumSet.allOf(BuiltinDHFactories.class)); + Collections.unmodifiableSet(EnumSet.allOf(BuiltinDHFactories.class)); private static final Map EXTENSIONS = - new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + new TreeMap<>(String.CASE_INSENSITIVE_ORDER); private final String factoryName; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/kex/KexProposalOption.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexProposalOption.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexProposalOption.java index f18ed95..ae20311 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexProposalOption.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexProposalOption.java @@ -46,7 +46,7 @@ public enum KexProposalOption { * Compares values according to {@link KexProposalOption#getProposalIndex()} */ public static final Comparator BY_PROPOSAL_INDEX = - Comparator.comparingInt(KexProposalOption::getProposalIndex); + Comparator.comparingInt(KexProposalOption::getProposalIndex); /** * A {@link List} of all the options sorted according to {@link #getProposalIndex()} @@ -55,9 +55,10 @@ public enum KexProposalOption { */ public static final List VALUES = Collections.unmodifiableList( - EnumSet.allOf(KexProposalOption.class).stream() - .sorted(BY_PROPOSAL_INDEX) - .collect(Collectors.toList())); + EnumSet.allOf(KexProposalOption.class) + .stream() + .sorted(BY_PROPOSAL_INDEX) + .collect(Collectors.toList())); public static final int PROPOSAL_MAX = VALUES.size(); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/kex/KexState.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexState.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexState.java index da5d65c..bd794f3 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/kex/KexState.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/KexState.java @@ -35,5 +35,6 @@ public enum KexState { KEYS, DONE; - public static final Set VALUES = Collections.unmodifiableSet(EnumSet.allOf(KexState.class)); + public static final Set VALUES = + Collections.unmodifiableSet(EnumSet.allOf(KexState.class)); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/kex/KeyExchange.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/KeyExchange.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/KeyExchange.java index 05f7863..f1b23b6 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/kex/KeyExchange.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/KeyExchange.java @@ -20,7 +20,7 @@ package org.apache.sshd.common.kex; import java.security.PublicKey; import java.util.Collections; -import java.util.Map; +import java.util.NavigableMap; import org.apache.sshd.common.NamedResource; import org.apache.sshd.common.SshConstants; @@ -36,11 +36,13 @@ import org.apache.sshd.common.util.logging.LoggingUtils; * @author Apache MINA SSHD Project */ public interface KeyExchange extends NamedResource { - Map GROUP_KEX_OPCODES_MAP = - Collections.unmodifiableMap(LoggingUtils.generateMnemonicMap(SshConstants.class, "SSH_MSG_KEX_DH_GEX_")); + NavigableMap GROUP_KEX_OPCODES_MAP = + Collections.unmodifiableNavigableMap( + LoggingUtils.generateMnemonicMap(SshConstants.class, "SSH_MSG_KEX_DH_GEX_")); - Map SIMPLE_KEX_OPCODES_MAP = - Collections.unmodifiableMap(LoggingUtils.generateMnemonicMap(SshConstants.class, "SSH_MSG_KEXDH_")); + NavigableMap SIMPLE_KEX_OPCODES_MAP = + Collections.unmodifiableNavigableMap( + LoggingUtils.generateMnemonicMap(SshConstants.class, "SSH_MSG_KEXDH_")); /** * Initialize the key exchange algorithm. http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java index 215b907..c66a7e3 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java @@ -262,9 +262,9 @@ public abstract class AbstractConnectionService @Override protected Closeable getInnerCloseable() { return builder() - .sequential(forwarderHolder.get(), agentForwardHolder.get(), x11ForwardHolder.get()) - .parallel(toString(), channels.values()) - .build(); + .sequential(forwarderHolder.get(), agentForwardHolder.get(), x11ForwardHolder.get()) + .parallel(toString(), channels.values()) + .build(); } protected int getNextChannelId() { @@ -304,7 +304,7 @@ public abstract class AbstractConnectionService protected void handleChannelRegistrationFailure(Channel channel, int channelId) throws IOException { RuntimeException reason = new IllegalStateException("Channel id=" + channelId + " not registered because session is being closed: " + this); AbstractChannel notifier = - ValidateUtils.checkInstanceOf(channel, AbstractChannel.class, "Non abstract channel for id=%d", channelId); + ValidateUtils.checkInstanceOf(channel, AbstractChannel.class, "Non abstract channel for id=%d", channelId); notifier.signalChannelClosed(reason); throw reason; } @@ -410,7 +410,7 @@ public abstract class AbstractConnectionService long rmpsize = buffer.getUInt(); if (log.isDebugEnabled()) { log.debug("channelOpenConfirmation({}) SSH_MSG_CHANNEL_OPEN_CONFIRMATION sender={}, window-size={}, packet-size={}", - channel, sender, rwsize, rmpsize); + channel, sender, rwsize, rmpsize); } /* * NOTE: the 'sender' of the SSH_MSG_CHANNEL_OPEN_CONFIRMATION is the @@ -580,7 +580,7 @@ public abstract class AbstractConnectionService if (handler == null) { // Throw a special exception - SSHD-777 throw new SshChannelNotFoundException(recipient, - "Received " + SshConstants.getCommandMessageName(cmd) + " on unknown channel " + recipient); + "Received " + SshConstants.getCommandMessageName(cmd) + " on unknown channel " + recipient); } @@ -610,12 +610,13 @@ public abstract class AbstractConnectionService boolean debugEnabled = log.isDebugEnabled(); if (debugEnabled) { log.debug("channelOpen({}) SSH_MSG_CHANNEL_OPEN sender={}, type={}, window-size={}, packet-size={}", - this, sender, type, rwsize, rmpsize); + this, sender, type, rwsize, rmpsize); } if (isClosing()) { // TODO add language tag configurable control - sendChannelOpenFailure(buffer, sender, SshConstants.SSH_OPEN_CONNECT_FAILED, "Server is shutting down while attempting to open channel type=" + type, ""); + sendChannelOpenFailure(buffer, sender, SshConstants.SSH_OPEN_CONNECT_FAILED, + "Server is shutting down while attempting to open channel type=" + type, ""); return; } @@ -642,7 +643,7 @@ public abstract class AbstractConnectionService Window window = channel.getLocalWindow(); if (debugEnabled) { log.debug("operationComplete({}) send SSH_MSG_CHANNEL_OPEN_CONFIRMATION recipient={}, sender={}, window-size={}, packet-size={}", - channel, sender, channelId, window.getSize(), window.getPacketSize()); + channel, sender, channelId, window.getSize(), window.getPacketSize()); } Buffer buf = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN_CONFIRMATION, Integer.SIZE); buf.putInt(sender); // remote (server side) identifier @@ -662,7 +663,7 @@ public abstract class AbstractConnectionService } } else { log.warn("operationComplete({}) no exception on closed future={}", - AbstractConnectionService.this, future); + AbstractConnectionService.this, future); } Buffer buf = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN_FAILURE, message.length() + Long.SIZE); @@ -681,12 +682,12 @@ public abstract class AbstractConnectionService protected IoWriteFuture sendChannelOpenFailure(Buffer buffer, int sender, int reasonCode, String message, String lang) throws IOException { if (log.isDebugEnabled()) { log.debug("sendChannelOpenFailure({}) sender={}, reason={}, lang={}, message='{}'", - this, sender, SshConstants.getOpenErrorCodeName(reasonCode), lang, message); + this, sender, SshConstants.getOpenErrorCodeName(reasonCode), lang, message); } AbstractSession session = getSession(); Buffer buf = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN_FAILURE, - Long.SIZE + GenericUtils.length(message) + GenericUtils.length(lang)); + Long.SIZE + GenericUtils.length(message) + GenericUtils.length(lang)); buf.putInt(sender); buf.putInt(reasonCode); buf.putString(message); @@ -708,8 +709,7 @@ public abstract class AbstractConnectionService boolean wantReply = buffer.getBoolean(); boolean debugEnabled = log.isDebugEnabled(); if (debugEnabled) { - log.debug("globalRequest({}) received SSH_MSG_GLOBAL_REQUEST {} want-reply={}", - this, req, wantReply); + log.debug("globalRequest({}) received SSH_MSG_GLOBAL_REQUEST {} want-reply={}", this, req, wantReply); } AbstractSession session = getSession(); @@ -723,7 +723,7 @@ public abstract class AbstractConnectionService result = handler.process(this, req, wantReply, buffer); } catch (Throwable e) { log.warn("globalRequest({})[{}, want-reply={}] failed ({}) to process: {}", - this, req, wantReply, e.getClass().getSimpleName(), e.getMessage()); + this, req, wantReply, e.getClass().getSimpleName(), e.getMessage()); if (debugEnabled) { log.debug("globalRequest(" + this + ")[" + req + ", want-reply=" + wantReply + "] failure details", e); } @@ -734,7 +734,7 @@ public abstract class AbstractConnectionService if (RequestHandler.Result.Unsupported.equals(result)) { if (traceEnabled) { log.trace("globalRequest({}) {}#process({})[want-reply={}] : {}", - this, handler.getClass().getSimpleName(), req, wantReply, result); + this, handler.getClass().getSimpleName(), req, wantReply, result); } } else { return sendGlobalResponse(buffer, req, result, wantReply); @@ -764,8 +764,8 @@ public abstract class AbstractConnectionService } byte cmd = RequestHandler.Result.ReplySuccess.equals(result) - ? SshConstants.SSH_MSG_REQUEST_SUCCESS - : SshConstants.SSH_MSG_REQUEST_FAILURE; + ? SshConstants.SSH_MSG_REQUEST_SUCCESS + : SshConstants.SSH_MSG_REQUEST_FAILURE; AbstractSession session = getSession(); Buffer rsp = session.createBuffer(cmd, 2); return session.writePacket(rsp); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java index 3a55e21..ac6b081 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java @@ -289,7 +289,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen Throwable e = GenericUtils.peelException(err); if (log.isDebugEnabled()) { log.debug("Failed ({}) to announce session={} created: {}", - e.getClass().getSimpleName(), ioSession, e.getMessage()); + e.getClass().getSimpleName(), ioSession, e.getMessage()); } if (log.isTraceEnabled()) { log.trace("Session=" + ioSession + " creation failure details", e); @@ -661,7 +661,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen if (result != null) { if (debugEnabled) { log.debug("handleFirstKexPacketFollows({})[{}] 1st follow KEX packet {} option mismatch: client={}, server={}", - this, SshConstants.getCommandMessageName(cmd), option, result.getKey(), result.getValue()); + this, SshConstants.getCommandMessageName(cmd), option, result.getKey(), result.getValue()); } return false; } @@ -780,7 +780,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen protected void handleDisconnect(int code, String msg, String lang, Buffer buffer) throws Exception { if (log.isDebugEnabled()) { log.debug("handleDisconnect({}) SSH_MSG_DISCONNECT reason={}, [lang={}] msg={}", - this, SshConstants.getDisconnectReasonName(code), lang, msg); + this, SshConstants.getDisconnectReasonName(code), lang, msg); } close(true); @@ -803,7 +803,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen } catch (Throwable e) { if (debugEnabled) { log.debug("handleServiceRequest({}) Service {} rejected: {} = {}", - this, serviceName, e.getClass().getSimpleName(), e.getMessage()); + this, serviceName, e.getClass().getSimpleName(), e.getMessage()); } if (log.isTraceEnabled()) { @@ -915,7 +915,9 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen } } - protected List> sendPendingPackets(Queue packetsQueue) throws IOException { + protected List> sendPendingPackets( + Queue packetsQueue) + throws IOException { if (GenericUtils.isEmpty(packetsQueue)) { return Collections.emptyList(); } @@ -956,7 +958,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen if ((!State.Opened.equals(curState)) && (!State.Graceful.equals(curState))) { if (log.isDebugEnabled()) { log.debug("exceptionCaught({}) ignore {} due to state={}, message='{}'", - this, t.getClass().getSimpleName(), curState, t.getMessage()); + this, t.getClass().getSimpleName(), curState, t.getMessage()); } if (log.isTraceEnabled()) { log.trace("exceptionCaught(" + this + ")[state=" + curState + "] ignored exception details", t); @@ -979,7 +981,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen } catch (Throwable t2) { if (log.isDebugEnabled()) { log.debug("exceptionCaught({}) {} while disconnect with code={}: {}", - this, t2.getClass().getSimpleName(), SshConstants.getDisconnectReasonName(code), t2.getMessage()); + this, t2.getClass().getSimpleName(), SshConstants.getDisconnectReasonName(code), t2.getMessage()); } if (log.isTraceEnabled()) { log.trace("exceptionCaught(" + this + ")[code=" + SshConstants.getDisconnectReasonName(code) + "] disconnect exception details", t2); @@ -1071,7 +1073,8 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen }); } catch (Throwable err) { Throwable e = GenericUtils.peelException(err); - log.warn("signalSessionClosed({}) {} while signal session closed: {}", this, e.getClass().getSimpleName(), e.getMessage()); + log.warn("signalSessionClosed({}) {} while signal session closed: {}", + this, e.getClass().getSimpleName(), e.getMessage()); if (log.isDebugEnabled()) { log.debug("signalSessionClosed(" + this + ") signal session closed exception details", e); } @@ -1126,8 +1129,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen synchronized (pendingPackets) { if (!KexState.DONE.equals(kexState.get())) { if (pendingPackets.isEmpty()) { - log.debug("writePacket({})[{}] Start flagging packets as pending until key exchange is done", - this, cmdName); + log.debug("writePacket({})[{}] Start flagging packets as pending until key exchange is done", this, cmdName); } PendingWriteFuture future = new PendingWriteFuture(cmdName, buffer); pendingPackets.add(future); @@ -1289,7 +1291,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen if (debugEnabled) { log.debug("request({}) request={}, timeout={} {}, result received={}", - this, request, timeout, unit, result != null); + this, request, timeout, unit, result != null); } if (result == null) { @@ -1620,7 +1622,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen */ protected List doReadIdentification(Buffer buffer, boolean server) { int maxIdentSize = PropertyResolverUtils.getIntProperty(this, - FactoryManager.MAX_IDENTIFICATION_SIZE, FactoryManager.DEFAULT_MAX_IDENTIFICATION_SIZE); + FactoryManager.MAX_IDENTIFICATION_SIZE, FactoryManager.DEFAULT_MAX_IDENTIFICATION_SIZE); List ident = null; int rpos = buffer.rpos(); for (byte[] data = new byte[MAX_VERSION_LINE_LENGTH];;) { @@ -1697,22 +1699,22 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen protected Map createProposal(String hostKeyTypes) { Map proposal = new EnumMap<>(KexProposalOption.class); proposal.put(KexProposalOption.ALGORITHMS, - NamedResource.getNames( - ValidateUtils.checkNotNullAndNotEmpty(getKeyExchangeFactories(), "No KEX factories"))); + NamedResource.getNames( + ValidateUtils.checkNotNullAndNotEmpty(getKeyExchangeFactories(), "No KEX factories"))); proposal.put(KexProposalOption.SERVERKEYS, hostKeyTypes); String ciphers = NamedResource.getNames( - ValidateUtils.checkNotNullAndNotEmpty(getCipherFactories(), "No cipher factories")); + ValidateUtils.checkNotNullAndNotEmpty(getCipherFactories(), "No cipher factories")); proposal.put(KexProposalOption.S2CENC, ciphers); proposal.put(KexProposalOption.C2SENC, ciphers); String macs = NamedResource.getNames( - ValidateUtils.checkNotNullAndNotEmpty(getMacFactories(), "No MAC factories")); + ValidateUtils.checkNotNullAndNotEmpty(getMacFactories(), "No MAC factories")); proposal.put(KexProposalOption.S2CMAC, macs); proposal.put(KexProposalOption.C2SMAC, macs); String compressions = NamedResource.getNames( - ValidateUtils.checkNotNullAndNotEmpty(getCompressionFactories(), "No compression factories")); + ValidateUtils.checkNotNullAndNotEmpty(getCompressionFactories(), "No compression factories")); proposal.put(KexProposalOption.S2CCOMP, compressions); proposal.put(KexProposalOption.C2SCOMP, compressions); @@ -1744,7 +1746,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen boolean traceEnabled = log.isTraceEnabled(); if (traceEnabled) { log.trace("sendKexInit({}) cookie={}", - this, BufferUtils.toHex(buffer.array(), p, SshConstants.MSG_KEX_COOKIE_SIZE, ':')); + this, BufferUtils.toHex(buffer.array(), p, SshConstants.MSG_KEX_COOKIE_SIZE, ':')); } for (KexProposalOption paramType : KexProposalOption.VALUES) { @@ -1786,7 +1788,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen boolean traceEnabled = log.isTraceEnabled(); if (traceEnabled) { log.trace("receiveKexInit({}) cookie={}", - this, BufferUtils.toHex(d, cookieStartPos, SshConstants.MSG_KEX_COOKIE_SIZE, ':')); + this, BufferUtils.toHex(d, cookieStartPos, SshConstants.MSG_KEX_COOKIE_SIZE, ':')); } // Read proposal @@ -1960,7 +1962,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen maxRekeyBlocks.set(this.getLongProperty(FactoryManager.REKEY_BLOCKS_LIMIT, recommendedByteRekeyBlocks)); if (debugEnabled) { log.debug("receiveNewKeys({}) inCipher={}, outCipher={}, recommended blocks limit={}, actual={}", - this, inCipher, outCipher, recommendedByteRekeyBlocks, maxRekeyBlocks); + this, inCipher, outCipher, recommendedByteRekeyBlocks, maxRekeyBlocks); } inBytesCount.set(0L); @@ -2103,7 +2105,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen String value = guess.get(paramType); if (value == null) { String message = "Unable to negotiate key exchange for " + paramType.getDescription() - + " (client: " + clientParamValue + " / server: " + serverParamValue + ")"; + + " (client: " + clientParamValue + " / server: " + serverParamValue + ")"; // OK if could not negotiate languages if (KexProposalOption.S2CLANG.equals(paramType) || KexProposalOption.C2SLANG.equals(paramType)) { if (traceEnabled) { @@ -2115,7 +2117,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen } else { if (traceEnabled) { log.trace("negotiate(" + this + ")[" + paramType.getDescription() + "] guess=" + value - + " (client: " + clientParamValue + " / server: " + serverParamValue + ")"); + + " (client: " + clientParamValue + " / server: " + serverParamValue + ")"); } } } @@ -2193,13 +2195,13 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen if (log.isDebugEnabled()) { log.debug("setNegotiationResult({}) Kex: server->client {} {} {}", this, - guess.get(KexProposalOption.S2CENC), - guess.get(KexProposalOption.S2CMAC), - guess.get(KexProposalOption.S2CCOMP)); + guess.get(KexProposalOption.S2CENC), + guess.get(KexProposalOption.S2CMAC), + guess.get(KexProposalOption.S2CCOMP)); log.debug("setNegotiationResult({}) Kex: client->server {} {} {}", this, - guess.get(KexProposalOption.C2SENC), - guess.get(KexProposalOption.C2SMAC), - guess.get(KexProposalOption.C2SCOMP)); + guess.get(KexProposalOption.C2SENC), + guess.get(KexProposalOption.C2SMAC), + guess.get(KexProposalOption.C2SCOMP)); } return guess; @@ -2245,8 +2247,8 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen @SuppressWarnings("unchecked") public T setAttribute(AttributeKey key, T value) { return (T) attributes.put( - Objects.requireNonNull(key, "No key"), - Objects.requireNonNull(value, "No value")); + Objects.requireNonNull(key, "No key"), + Objects.requireNonNull(value, "No value")); } @Override @@ -2272,7 +2274,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen @Override public ReservedSessionMessagesHandler getReservedSessionMessagesHandler() { return resolveEffectiveProvider(ReservedSessionMessagesHandler.class, - reservedSessionMessagesHandler, getFactoryManager().getReservedSessionMessagesHandler()); + reservedSessionMessagesHandler, getFactoryManager().getReservedSessionMessagesHandler()); } @Override @@ -2425,7 +2427,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen Throwable t = GenericUtils.peelException(err); if (log.isDebugEnabled()) { log.debug("sendSessionEvent({})[{}] failed ({}) to inform listeners: {}", - this, event, t.getClass().getSimpleName(), t.getMessage()); + this, event, t.getClass().getSimpleName(), t.getMessage()); } if (log.isTraceEnabled()) { log.trace("sendSessionEvent(" + this + ")[" + event + "] listener inform details", t); @@ -2550,8 +2552,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen if (rekey) { if (log.isDebugEnabled()) { log.debug("isRekeyTimeIntervalExceeded({}) re-keying: last={}, now={}, diff={}, max={}", - this, new Date(lastKeyTimeValue.get()), new Date(now), - rekeyDiff, maxRekeyInterval); + this, new Date(lastKeyTimeValue.get()), new Date(now), rekeyDiff, maxRekeyInterval); } } @@ -2567,7 +2568,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen if (rekey) { if (log.isDebugEnabled()) { log.debug("isRekeyPacketCountsExceeded({}) re-keying: in={}, out={}, max={}", - this, inPacketsCount, outPacketsCount, maxRekyPackets); + this, inPacketsCount, outPacketsCount, maxRekyPackets); } } @@ -2583,7 +2584,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen if (rekey) { if (log.isDebugEnabled()) { log.debug("isRekeyDataSizeExceeded({}) re-keying: in={}, out={}, max={}", - this, inBytesCount, outBytesCount, maxRekeyBytes); + this, inBytesCount, outBytesCount, maxRekeyBytes); } } @@ -2600,7 +2601,7 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen if (rekey) { if (log.isDebugEnabled()) { log.debug("isRekeyBlocksCountExceeded({}) re-keying: in={}, out={}, max={}", - this, inBlocksCount, outBlocksCount, maxBlocks); + this, inBlocksCount, outBlocksCount, maxBlocks); } } @@ -2702,7 +2703,9 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen protected abstract void receiveKexInit(Map proposal, byte[] seed) throws IOException; // returns the proposal argument - protected Map mergeProposals(Map current, Map proposal) { + protected Map mergeProposals( + Map current, Map proposal) { + // Checking references by design if (current == proposal) { return proposal; // nothing to merge } @@ -2826,7 +2829,9 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen protected SimpleImmutableEntry checkAuthenticationTimeout(long now, long authTimeoutMs) { long authDiff = now - authTimeoutStart; if ((!authed) && (authTimeoutMs > 0L) && (authDiff > authTimeoutMs)) { - return new SimpleImmutableEntry<>(TimeoutStatus.AuthTimeout, "Session has timed out waiting for authentication after " + authTimeoutMs + " ms."); + return new SimpleImmutableEntry<>( + TimeoutStatus.AuthTimeout, + "Session has timed out waiting for authentication after " + authTimeoutMs + " ms."); } else { return null; } @@ -2844,7 +2849,9 @@ public abstract class AbstractSession extends AbstractKexFactoryManager implemen protected SimpleImmutableEntry checkIdleTimeout(long now, long idleTimeoutMs) { long idleDiff = now - idleTimeoutStart; if ((idleTimeoutMs > 0L) && (idleDiff > idleTimeoutMs)) { - return new SimpleImmutableEntry<>(TimeoutStatus.IdleTimeout, "User session has timed out idling after " + idleTimeoutMs + " ms."); + return new SimpleImmutableEntry<>( + TimeoutStatus.IdleTimeout, + "User session has timed out idling after " + idleTimeoutMs + " ms."); } else { return null; } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java b/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java index aa6c75b..2698eab 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java @@ -60,25 +60,30 @@ public class ServerBuilder extends BaseBuilder { : DHGServer.newFactory(factory); public static final List> DEFAULT_CHANNEL_FACTORIES = - Collections.unmodifiableList(Arrays.>asList( - ChannelSessionFactory.INSTANCE, - DirectTcpipFactory.INSTANCE - )); + Collections.unmodifiableList( + Arrays.>asList( + ChannelSessionFactory.INSTANCE, + DirectTcpipFactory.INSTANCE + )); public static final List> DEFAULT_GLOBAL_REQUEST_HANDLERS = - Collections.unmodifiableList(Arrays.>asList( - KeepAliveHandler.INSTANCE, - NoMoreSessionsHandler.INSTANCE, - TcpipForwardHandler.INSTANCE, - CancelTcpipForwardHandler.INSTANCE, - OpenSshHostKeysHandler.INSTANCE - )); + Collections.unmodifiableList( + Arrays.>asList( + KeepAliveHandler.INSTANCE, + NoMoreSessionsHandler.INSTANCE, + TcpipForwardHandler.INSTANCE, + CancelTcpipForwardHandler.INSTANCE, + OpenSshHostKeysHandler.INSTANCE + )); public static final PublickeyAuthenticator DEFAULT_PUBLIC_KEY_AUTHENTICATOR = DefaultAuthorizedKeysAuthenticator.INSTANCE; public static final KeyboardInteractiveAuthenticator DEFAULT_INTERACTIVE_AUTHENTICATOR = DefaultKeyboardInteractiveAuthenticator.INSTANCE; public static final List DEFAULT_COMPRESSION_FACTORIES = - Collections.unmodifiableList(Arrays.asList( - BuiltinCompressions.none, BuiltinCompressions.zlib, BuiltinCompressions.delayedZlib)); + Collections.unmodifiableList( + Arrays.asList( + BuiltinCompressions.none, + BuiltinCompressions.zlib, + BuiltinCompressions.delayedZlib)); protected PublickeyAuthenticator pubkeyAuthenticator; protected KeyboardInteractiveAuthenticator interactiveAuthenticator; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/server/Signal.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/Signal.java b/sshd-core/src/main/java/org/apache/sshd/server/Signal.java index bbbddb6..79f2eef 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/Signal.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/Signal.java @@ -21,7 +21,7 @@ package org.apache.sshd.server; import java.util.Collections; import java.util.Comparator; import java.util.EnumSet; -import java.util.Map; +import java.util.NavigableMap; import java.util.Set; import java.util.function.Function; @@ -68,24 +68,25 @@ public enum Signal { /** * An un-modifiable {@link Set} of all the available {@link Signal}s */ - public static final Set SIGNALS = Collections.unmodifiableSet(EnumSet.allOf(Signal.class)); + public static final Set SIGNALS = + Collections.unmodifiableSet(EnumSet.allOf(Signal.class)); /** - * An un-modifiable case-insensitive {@link Map} of the names of all available {@link Signal}s + * An un-modifiable case-insensitive {@link NavigableMap} of the names of all available {@link Signal}s * @see #SIGNALS */ - public static final Map NAME_LOOKUP_TABLE = - Collections.unmodifiableMap( - GenericUtils.toSortedMap(SIGNALS, Signal::name, Function.identity(), String.CASE_INSENSITIVE_ORDER)); + public static final NavigableMap NAME_LOOKUP_TABLE = + Collections.unmodifiableNavigableMap( + GenericUtils.toSortedMap(SIGNALS, Signal::name, Function.identity(), String.CASE_INSENSITIVE_ORDER)); /** - * An un-modifiable {@link Map} of the numeric values of all available {@link Signal}s + * An un-modifiable {@link NavigableMap} of the numeric values of all available {@link Signal}s * @see #SIGNALS * @see #getNumeric() */ - public static final Map NUMERIC_LOOKUP_TABLE = - Collections.unmodifiableMap( - GenericUtils.toSortedMap(SIGNALS, Signal::getNumeric, Function.identity(), Comparator.naturalOrder())); + public static final NavigableMap NUMERIC_LOOKUP_TABLE = + Collections.unmodifiableNavigableMap( + GenericUtils.toSortedMap(SIGNALS, Signal::getNumeric, Function.identity(), Comparator.naturalOrder())); private final int numeric; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java b/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java index f648eb1..ea8f74a 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java @@ -87,10 +87,10 @@ public class SshServer extends AbstractFactoryManager implements ServerFactoryMa public static final Factory DEFAULT_SSH_SERVER_FACTORY = SshServer::new; public static final List DEFAULT_SERVICE_FACTORIES = - Collections.unmodifiableList(Arrays.asList( + Collections.unmodifiableList( + Arrays.asList( ServerUserAuthServiceFactory.INSTANCE, - ServerConnectionServiceFactory.INSTANCE - )); + ServerConnectionServiceFactory.INSTANCE)); protected IoAcceptor acceptor; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java index a77512d..6477019 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java @@ -51,7 +51,7 @@ public enum BuiltinUserAuthFactories implements NamedFactory { GSS(UserAuthGSSFactory.INSTANCE); public static final Set VALUES = - Collections.unmodifiableSet(EnumSet.allOf(BuiltinUserAuthFactories.class)); + Collections.unmodifiableSet(EnumSet.allOf(BuiltinUserAuthFactories.class)); private final UserAuthFactory factory; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/server/auth/WelcomeBannerPhase.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/WelcomeBannerPhase.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/WelcomeBannerPhase.java index 66becc1..0e1e52e 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/auth/WelcomeBannerPhase.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/WelcomeBannerPhase.java @@ -49,5 +49,5 @@ public enum WelcomeBannerPhase { NEVER; public static final Set VALUES = - Collections.unmodifiableSet(EnumSet.allOf(WelcomeBannerPhase.class)); + Collections.unmodifiableSet(EnumSet.allOf(WelcomeBannerPhase.class)); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java index 5e12821..4349e1b 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java @@ -51,16 +51,12 @@ public abstract class AbstractServerChannel extends AbstractChannel implements S super("", false, Collections.emptyList(), executor); } - protected AbstractServerChannel(String discriminator, Collection> handlers, CloseableExecutorService executor) { + protected AbstractServerChannel(String discriminator, + Collection> handlers, + CloseableExecutorService executor) { super(discriminator, false, handlers, executor); } -// TODO: investigate how to fix the forwarding channel failures when enabled -// @Override -// public ServerSession getSession() { -// return (ServerSession) super.getSession(); -// } - @Override public ServerSession getServerSession() { return (ServerSession) getSession(); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java index 16e16b7..e54e0e4 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java @@ -123,10 +123,10 @@ public class ChannelSession extends AbstractServerChannel { @Override protected Closeable getInnerCloseable() { return builder() - .sequential(new CommandCloseable(), super.getInnerCloseable()) - .parallel(asyncOut, asyncErr) - .run(toString(), this::closeImmediately0) - .build(); + .sequential(new CommandCloseable(), super.getInnerCloseable()) + .parallel(asyncOut, asyncErr) + .run(toString(), this::closeImmediately0) + .build(); } public class CommandCloseable extends IoBaseCloseable { @@ -160,14 +160,15 @@ public class ChannelSession extends AbstractServerChannel { commandExitFuture.setClosed(); } else if (!commandExitFuture.isClosed()) { IOException e = IoUtils.closeQuietly(receiver); + boolean debugEnabled = log.isDebugEnabled(); if (e != null) { - if (log.isDebugEnabled()) { + if (debugEnabled) { log.debug("close({})[immediately={}] failed ({}) to close receiver: {}", - this, immediately, e.getClass().getSimpleName(), e.getMessage()); + this, immediately, e.getClass().getSimpleName(), e.getMessage()); } } - final TimerTask task = new TimerTask() { + TimerTask task = new TimerTask() { @Override public void run() { commandExitFuture.setClosed(); @@ -175,9 +176,9 @@ public class ChannelSession extends AbstractServerChannel { }; ChannelSession channel = ChannelSession.this; - long timeout = PropertyResolverUtils.getLongProperty( - channel, ServerFactoryManager.COMMAND_EXIT_TIMEOUT, ServerFactoryManager.DEFAULT_COMMAND_EXIT_TIMEOUT); - if (log.isDebugEnabled()) { + long timeout = PropertyResolverUtils.getLongProperty(channel, + ServerFactoryManager.COMMAND_EXIT_TIMEOUT, ServerFactoryManager.DEFAULT_COMMAND_EXIT_TIMEOUT); + if (debugEnabled) { log.debug("Wait {} ms for shell to exit cleanly on {}", timeout, channel); } @@ -198,7 +199,7 @@ public class ChannelSession extends AbstractServerChannel { commandInstance.destroy(); } catch (Throwable e) { log.warn("doCloseImmediately({}) failed ({}) to destroy command: {}", - this, e.getClass().getSimpleName(), e.getMessage()); + this, e.getClass().getSimpleName(), e.getMessage()); if (debugEnabled) { log.debug("doCloseImmediately(" + this + ") command destruction failure details", e); } @@ -211,7 +212,7 @@ public class ChannelSession extends AbstractServerChannel { if (e != null) { if (debugEnabled) { log.debug("doCloseImmediately({}) failed ({}) to close resources: {}", - this, e.getClass().getSimpleName(), e.getMessage()); + this, e.getClass().getSimpleName(), e.getMessage()); } if (log.isTraceEnabled()) { @@ -233,7 +234,7 @@ public class ChannelSession extends AbstractServerChannel { if (e != null) { if (log.isDebugEnabled()) { log.debug("handleEof({}) failed ({}) to close receiver: {}", - this, e.getClass().getSimpleName(), e.getMessage()); + this, e.getClass().getSimpleName(), e.getMessage()); } if (log.isTraceEnabled()) { @@ -293,7 +294,7 @@ public class ChannelSession extends AbstractServerChannel { } else { if (log.isDebugEnabled()) { log.debug("handleInternalRequest({})[want-reply={}] type already set for request={}: {}", - this, wantReply, requestType, this.type); + this, wantReply, requestType, this.type); } return RequestHandler.Result.ReplyFailure; } @@ -307,7 +308,7 @@ public class ChannelSession extends AbstractServerChannel { } else { if (log.isDebugEnabled()) { log.debug("handleInternalRequest({})[want-reply={}] type already set for request={}: {}", - this, wantReply, requestType, this.type); + this, wantReply, requestType, this.type); } return RequestHandler.Result.ReplyFailure; } @@ -321,7 +322,7 @@ public class ChannelSession extends AbstractServerChannel { } else { if (log.isDebugEnabled()) { log.debug("handleInternalRequest({})[want-reply={}] type already set for request={}: {}", - this, wantReply, requestType, this.type); + this, wantReply, requestType, this.type); } return RequestHandler.Result.ReplyFailure; } @@ -417,7 +418,7 @@ public class ChannelSession extends AbstractServerChannel { if (log.isDebugEnabled()) { log.debug("handlePtyReq({}): term={}, size=({} - {}), pixels=({}, {}), modes=[{}]", - this, term, tColumns, tRows, tWidth, tHeight, ptyModes); + this, term, tColumns, tRows, tWidth, tHeight, ptyModes); } addEnvVariable(Environment.ENV_TERM, term); @@ -432,8 +433,7 @@ public class ChannelSession extends AbstractServerChannel { int tWidth = buffer.getInt(); int tHeight = buffer.getInt(); if (log.isDebugEnabled()) { - log.debug("handleWindowChange({}): ({} - {}), ({}, {})", - this, tColumns, tRows, tWidth, tHeight); + log.debug("handleWindowChange({}): ({} - {}), ({}, {})", this, tColumns, tRows, tWidth, tHeight); } StandardEnvironment e = getEnvironment(); @@ -492,7 +492,7 @@ public class ChannelSession extends AbstractServerChannel { commandInstance = factory.create(); } catch (RuntimeException | Error e) { log.warn("handleShell({}) Failed ({}) to create shell: {}", - this, e.getClass().getSimpleName(), e.getMessage()); + this, e.getClass().getSimpleName(), e.getMessage()); if (log.isDebugEnabled()) { log.debug("handleShell(" + this + ") shell creation failure details", e); } @@ -532,7 +532,7 @@ public class ChannelSession extends AbstractServerChannel { commandInstance = factory.createCommand(commandLine); } catch (RuntimeException | Error e) { log.warn("handleExec({}) Failed ({}) to create command for {}: {}", - this, e.getClass().getSimpleName(), commandLine, e.getMessage()); + this, e.getClass().getSimpleName(), commandLine, e.getMessage()); if (debugEnabled) { log.debug("handleExec(" + this + ") command=" + commandLine + " creation failure details", e); } @@ -551,8 +551,7 @@ public class ChannelSession extends AbstractServerChannel { protected RequestHandler.Result handleSubsystem(String request, Buffer buffer, boolean wantReply) throws IOException { String subsystem = buffer.getString(); if (log.isDebugEnabled()) { - log.debug("handleSubsystem({})[want-reply={}] subsystem={}", - this, wantReply, subsystem); + log.debug("handleSubsystem({})[want-reply={}] subsystem={}", this, wantReply, subsystem); } ServerFactoryManager manager = Objects.requireNonNull(getServerSession(), "No server session").getFactoryManager(); @@ -566,7 +565,7 @@ public class ChannelSession extends AbstractServerChannel { commandInstance = NamedFactory.create(factories, subsystem); } catch (RuntimeException | Error e) { log.warn("handleSubsystem({}) Failed ({}) to create command for subsystem={}: {}", - this, e.getClass().getSimpleName(), subsystem, e.getMessage()); + this, e.getClass().getSimpleName(), subsystem, e.getMessage()); if (log.isDebugEnabled()) { log.debug("handleSubsystem(" + this + ") subsystem=" + subsystem + " creation failure details", e); } @@ -693,7 +692,7 @@ public class ChannelSession extends AbstractServerChannel { } } catch (IOException e) { log.warn("onExit({}) code={} message='{}' {} closing shell: {}", - ChannelSession.this, exitValue, exitMessage, e.getClass().getSimpleName(), e.getMessage()); + ChannelSession.this, exitValue, exitMessage, e.getClass().getSimpleName(), e.getMessage()); } }); @@ -715,7 +714,8 @@ public class ChannelSession extends AbstractServerChannel { try { if ((factory == null) || (filter == null) || (!filter.canForwardAgent(session, requestType))) { if (debugEnabled) { - log.debug("handleAgentForwarding(" + this + ")[haveFactory=" + (factory != null) + ",haveFilter=" + (filter != null) + "] filtered out request=" + requestType); + log.debug("handleAgentForwarding(" + this + ")[haveFactory=" + (factory != null) + + ",haveFilter=" + (filter != null) + "] filtered out request=" + requestType); } return RequestHandler.Result.ReplyFailure; } @@ -755,13 +755,13 @@ public class ChannelSession extends AbstractServerChannel { if ((filter == null) || (!filter.canForwardX11(session, requestType))) { if (debugEnabled) { log.debug("handleX11Forwarding({}) single={}, protocol={}, cookie={}, screen={}, filter={}: filtered request={}", - this, singleConnection, authProtocol, authCookie, screenId, filter, requestType); + this, singleConnection, authProtocol, authCookie, screenId, filter, requestType); } return RequestHandler.Result.ReplyFailure; } } catch (Error e) { log.warn("handleX11Forwarding({}) failed ({}) to consult forwarding filter for '{}': {}", - this, e.getClass().getSimpleName(), requestType, e.getMessage()); + this, e.getClass().getSimpleName(), requestType, e.getMessage()); if (debugEnabled) { log.debug("handleX11Forwarding(" + this + ")[" + requestType + "] filter consultation failure details", e); } @@ -772,7 +772,7 @@ public class ChannelSession extends AbstractServerChannel { if (x11Forward == null) { if (debugEnabled) { log.debug("handleX11Forwarding({}) single={}, protocol={}, cookie={}, screen={} - no forwarder'", - this, singleConnection, authProtocol, authCookie, screenId); + this, singleConnection, authProtocol, authCookie, screenId); } return RequestHandler.Result.ReplyFailure; } @@ -780,7 +780,7 @@ public class ChannelSession extends AbstractServerChannel { String display = x11Forward.createDisplay(singleConnection, authProtocol, authCookie, screenId); if (debugEnabled) { log.debug("handleX11Forwarding({}) single={}, protocol={}, cookie={}, screen={} - display='{}'", - this, singleConnection, authProtocol, authCookie, screenId, display); + this, singleConnection, authProtocol, authCookie, screenId, display); } if (GenericUtils.isEmpty(display)) { return RequestHandler.Result.ReplyFailure; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/server/channel/PuttyRequestHandler.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/PuttyRequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/PuttyRequestHandler.java index fd71753..a5eabe1 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/channel/PuttyRequestHandler.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/PuttyRequestHandler.java @@ -41,7 +41,7 @@ public class PuttyRequestHandler extends AbstractChannelRequestHandler { public static final String REQUEST_SUFFIX = "@putty.projects.tartarus.org"; public static final Set PUTTY_OPTIONS = - Collections.unmodifiableSet(EnumSet.of(PtyMode.ECHO, PtyMode.ICRNL, PtyMode.ONLCR)); + Collections.unmodifiableSet(EnumSet.of(PtyMode.ECHO, PtyMode.ICRNL, PtyMode.ONLCR)); public static final PuttyRequestHandler INSTANCE = new PuttyRequestHandler(); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractFileSystemCommand.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractFileSystemCommand.java b/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractFileSystemCommand.java index b1049e1..be5e578 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractFileSystemCommand.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractFileSystemCommand.java @@ -58,7 +58,7 @@ public abstract class AbstractFileSystemCommand extends AbstractCommandSupport i } catch (UnsupportedOperationException | IOException e) { if (log.isDebugEnabled()) { log.debug("destroy({}) - failed ({}) to close file system={}: {}", - this, e.getClass().getSimpleName(), fileSystem, e.getMessage()); + this, e.getClass().getSimpleName(), fileSystem, e.getMessage()); } } finally { fileSystem = null; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/server/config/AllowTcpForwardingValue.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/config/AllowTcpForwardingValue.java b/sshd-core/src/main/java/org/apache/sshd/server/config/AllowTcpForwardingValue.java index ed6d7f8..f346744 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/config/AllowTcpForwardingValue.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/config/AllowTcpForwardingValue.java @@ -79,7 +79,7 @@ public enum AllowTcpForwardingValue implements TcpForwardingFilter { }; public static final Set VALUES = - Collections.unmodifiableSet(EnumSet.allOf(AllowTcpForwardingValue.class)); + Collections.unmodifiableSet(EnumSet.allOf(AllowTcpForwardingValue.class)); // NOTE: it also interprets "yes" as "all" and "no" as "none" public static AllowTcpForwardingValue fromString(String s) { http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/612ee385/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpForwardingFilter.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpForwardingFilter.java b/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpForwardingFilter.java index 3f0aaa7..2cbf468 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpForwardingFilter.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpForwardingFilter.java @@ -78,7 +78,7 @@ public interface TcpForwardingFilter { Forwarded("forwarded-tcpip"); public static final Set VALUES = - Collections.unmodifiableSet(EnumSet.allOf(Type.class)); + Collections.unmodifiableSet(EnumSet.allOf(Type.class)); private final String name;