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 2015/05/14 16:36:28 UTC

mina-sshd git commit: [SSHD-450] Consider logging session setup with level 'debug'

Repository: mina-sshd
Updated Branches:
  refs/heads/master 06e9af740 -> 7df17efd6


[SSHD-450] Consider logging session setup with level 'debug'


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/7df17efd
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/7df17efd
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/7df17efd

Branch: refs/heads/master
Commit: 7df17efd6561372e32c84138c3f05f30a3ec2b8a
Parents: 06e9af7
Author: Lyor Goldstein <lg...@vmware.com>
Authored: Thu May 14 17:36:22 2015 +0300
Committer: Lyor Goldstein <lg...@vmware.com>
Committed: Thu May 14 17:36:22 2015 +0300

----------------------------------------------------------------------
 .../auth/UserAuthKeyboardInteractive.java       | 17 +++++-
 .../client/channel/AbstractClientChannel.java   | 15 ++++-
 .../keyverifier/AcceptAllServerKeyVerifier.java |  3 +-
 .../sshd/common/channel/AbstractChannel.java    |  5 +-
 .../sshd/common/forward/TcpipServerChannel.java | 12 +++-
 .../sshd/common/future/DefaultSshFuture.java    |  9 +++
 .../sshd/common/session/AbstractSession.java    | 41 ++++++++-----
 .../apache/sshd/common/util/CloseableUtils.java |  9 ++-
 .../sshd/server/channel/ChannelSession.java     | 63 +++++++++++++-------
 .../server/session/ServerUserAuthService.java   |  5 +-
 10 files changed, 128 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/7df17efd/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractive.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractive.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractive.java
index c623cec..f4d2133 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractive.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthKeyboardInteractive.java
@@ -19,6 +19,7 @@
 package org.apache.sshd.client.auth;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
@@ -28,6 +29,7 @@ import org.apache.sshd.client.UserAuth;
 import org.apache.sshd.client.UserInteraction;
 import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.SshConstants;
+import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -43,9 +45,11 @@ import static org.apache.sshd.common.SshConstants.SSH_MSG_USERAUTH_INFO_RESPONSE
 public class UserAuthKeyboardInteractive implements UserAuth {
 
     public static class Factory implements NamedFactory<UserAuth> {
+        @Override
         public String getName() {
             return "keyboard-interactive";
         }
+        @Override
         public UserAuth create() {
             return new UserAuthKeyboardInteractive();
         }
@@ -59,6 +63,7 @@ public class UserAuthKeyboardInteractive implements UserAuth {
     private int nbTrials;
     private int maxTrials;
 
+    @Override
     public void init(ClientSession session, String service, List<Object> identities) throws Exception {
         this.session = session;
         this.service = service;
@@ -72,6 +77,7 @@ public class UserAuthKeyboardInteractive implements UserAuth {
         this.maxTrials = session.getIntProperty(ClientFactoryManager.PASSWORD_PROMPTS, 3);
     }
 
+    @Override
     public boolean process(Buffer buffer) throws Exception {
         if (buffer == null) {
             if (passwords.hasNext()) {
@@ -105,12 +111,15 @@ public class UserAuthKeyboardInteractive implements UserAuth {
                 prompt[i] = buffer.getString();
                 echo[i] = (buffer.getByte() != 0);
             }
-            log.debug("Promt: {}", prompt);
-            log.debug("Echo: {}", echo);
+            
+            if (log.isDebugEnabled()) {
+                log.debug("Promt: {}", Arrays.toString(prompt));
+                log.debug("Echo: {}", echo);
+            }
 
             String[] rep = null;
             if (num == 0) {
-                rep = new String[0];
+                rep = GenericUtils.EMPTY_STRING_ARRAY;
             } else if (num == 1 && current != null && !echo[0] && prompt[0].toLowerCase().startsWith("password:")) {
                 rep = new String[] { current };
             } else {
@@ -138,6 +147,8 @@ public class UserAuthKeyboardInteractive implements UserAuth {
         throw new IllegalStateException("Received unknown packet");
     }
 
+    @Override
     public void destroy() {
+        // nothing
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/7df17efd/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
index 9fff35c..7481884 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
@@ -148,6 +148,7 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
         return builder()
                 .when(openFuture)
                 .run(new Runnable() {
+                    @SuppressWarnings("synthetic-access")
                     @Override
                     public void run() {
                         // If the channel has not been opened yet,
@@ -192,7 +193,10 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
                     cond |= ClientChannel.EXIT_SIGNAL;
                 }
                 if ((cond & mask) != 0) {
-                    log.trace("WaitFor call returning on channel {}, mask={}, cond={}", new Object[] { this, mask, cond });
+                    if (log.isTraceEnabled()) {
+                        log.trace("WaitFor call returning on channel {}, mask={}, cond={}",
+                                  new Object[] { this, Integer.valueOf(mask), Integer.valueOf(cond) });
+                    }
                     return cond;
                 }
                 if (timeout > 0) {
@@ -207,7 +211,10 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
                     }
                 }
                 try {
-                    log.trace("Waiting for lock on channel {}, mask={}, cond={}", new Object[] { this, mask, cond });
+                    if (log.isTraceEnabled()) {
+                        log.trace("Waiting for lock on channel {}, mask={}, cond={}",
+                                  new Object[] { this, Integer.valueOf(mask), Integer.valueOf(cond) });
+                    }
                     if (timeout > 0) {
                         lock.wait(timeout);
                     } else {
@@ -325,10 +332,11 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
     }
 
     private class ExitStatusChannelRequestHandler implements RequestHandler<Channel> {
+        @SuppressWarnings("synthetic-access")
         @Override
         public Result process(Channel channel, String request, boolean wantReply, Buffer buffer) throws Exception {
             if (request.equals("exit-status")) {
-                exitStatus = buffer.getInt();
+                exitStatus = Integer.valueOf(buffer.getInt());
                 notifyStateChanged();
                 return Result.ReplySuccess;
             }
@@ -337,6 +345,7 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
     }
 
     private class ExitSignalChannelRequestHandler implements RequestHandler<Channel> {
+        @SuppressWarnings("synthetic-access")
         @Override
         public Result process(Channel channel, String request, boolean wantReply, Buffer buffer) throws Exception {
             if (request.equals("exit-signal")) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/7df17efd/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/AcceptAllServerKeyVerifier.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/AcceptAllServerKeyVerifier.java b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/AcceptAllServerKeyVerifier.java
index 8fa9005..9836618 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/AcceptAllServerKeyVerifier.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/AcceptAllServerKeyVerifier.java
@@ -41,7 +41,8 @@ public class AcceptAllServerKeyVerifier implements ServerKeyVerifier {
 	private AcceptAllServerKeyVerifier() {
 	}
 
-	public boolean verifyServerKey(ClientSession sshClientSession, SocketAddress remoteAddress, PublicKey serverKey) {
+	@Override
+    public boolean verifyServerKey(ClientSession sshClientSession, SocketAddress remoteAddress, PublicKey serverKey) {
         log.warn("Server at {} presented unverified {} key: {}",
                 new Object[] { remoteAddress, serverKey.getAlgorithm(), KeyUtils.getFingerPrint(serverKey) });
 		return true;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/7df17efd/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 a5c6555..88ff823 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
@@ -192,6 +192,7 @@ public abstract class AbstractChannel extends CloseableUtils.AbstractInnerClosea
                 try {
                     long timeout = FactoryManagerUtils.getLongProperty(getSession(), FactoryManager.CHANNEL_CLOSE_TIMEOUT, DEFAULT_CHANNEL_CLOSE_TIMEOUT);
                     session.writePacket(buffer, timeout, TimeUnit.MILLISECONDS).addListener(new SshFutureListener<IoWriteFuture>() {
+                        @SuppressWarnings("synthetic-access")
                         @Override
                         public void operationComplete(IoWriteFuture future) {
                             if (future.isWritten()) {
@@ -303,7 +304,9 @@ public abstract class AbstractChannel extends CloseableUtils.AbstractInnerClosea
     }
 
     protected void sendWindowAdjust(int len) throws IOException {
-        log.debug("Send SSH_MSG_CHANNEL_WINDOW_ADJUST on channel {}", id);
+        if (log.isDebugEnabled()) {
+            log.debug("Send SSH_MSG_CHANNEL_WINDOW_ADJUST on channel {}", Integer.valueOf(id));
+        }
         Buffer buffer = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_WINDOW_ADJUST);
         buffer.putInt(recipient);
         buffer.putInt(len);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/7df17efd/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipServerChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipServerChannel.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipServerChannel.java
index a828de6..497ab55 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipServerChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipServerChannel.java
@@ -99,7 +99,7 @@ public class TcpipServerChannel extends AbstractServerChannel {
         String originatorIpAddress = buffer.getString();
         int originatorPort = buffer.getInt();
         log.info("Receiving request for direct tcpip: hostToConnect={}, portToConnect={}, originatorIpAddress={}, originatorPort={}",
-                new Object[] { hostToConnect, portToConnect, originatorIpAddress, originatorPort });
+                new Object[] { hostToConnect, Integer.valueOf(portToConnect), originatorIpAddress, Integer.valueOf(originatorPort) });
 
 
         SshdSocketAddress address = null;
@@ -117,10 +117,13 @@ public class TcpipServerChannel extends AbstractServerChannel {
         // TODO: revisit for better threading. Use async io ?
         out = new ChannelOutputStream(this, remoteWindow, log, SshConstants.SSH_MSG_CHANNEL_DATA);
         IoHandler handler = new IoHandler() {
+            @SuppressWarnings("synthetic-access")
             @Override
             public void messageReceived(IoSession session, Readable message) throws Exception {
                 if (isClosing()) {
-                    log.debug("Ignoring write to channel {} in CLOSING state", id);
+                    if (log.isDebugEnabled()) {
+                        log.debug("Ignoring write to channel {} in CLOSING state", Integer.valueOf(id));
+                    }
                 } else {
                     Buffer buffer = new ByteArrayBuffer();
                     buffer.putBuffer(message);
@@ -130,6 +133,7 @@ public class TcpipServerChannel extends AbstractServerChannel {
             }
             @Override
             public void sessionCreated(IoSession session) throws Exception {
+                // ignored
             }
             @Override
             public void sessionClosed(IoSession session) throws Exception {
@@ -144,6 +148,7 @@ public class TcpipServerChannel extends AbstractServerChannel {
                 .createConnector(handler);
         IoConnectFuture future = connector.connect(address.toInetSocketAddress());
         future.addListener(new SshFutureListener<IoConnectFuture>() {
+            @SuppressWarnings("synthetic-access")
             @Override
             public void operationComplete(IoConnectFuture future) {
                 if (future.isConnected()) {
@@ -180,6 +185,7 @@ public class TcpipServerChannel extends AbstractServerChannel {
         // connector in the background.
         //
         new Thread("TcpIpServerChannel-ConnectorCleanup") {
+            @SuppressWarnings("synthetic-access")
             @Override
             public void run() {
                 connector.close(true);
@@ -190,6 +196,7 @@ public class TcpipServerChannel extends AbstractServerChannel {
     @Override
     public CloseFuture close(boolean immediately) {
         return super.close(immediately).addListener(new SshFutureListener<CloseFuture>() {
+            @SuppressWarnings("synthetic-access")
             @Override
             public void operationComplete(CloseFuture sshFuture) {
                 closeImmediately0();
@@ -203,6 +210,7 @@ public class TcpipServerChannel extends AbstractServerChannel {
         Buffer buf = new ByteArrayBuffer(data, off, len);
         buf = new ByteArrayBuffer(buf.getCompactData());
         ioSession.write(buf).addListener(new SshFutureListener<IoWriteFuture>() {
+            @SuppressWarnings("synthetic-access")
             @Override
             public void operationComplete(IoWriteFuture future) {
                 try {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/7df17efd/sshd-core/src/main/java/org/apache/sshd/common/future/DefaultSshFuture.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/future/DefaultSshFuture.java b/sshd-core/src/main/java/org/apache/sshd/common/future/DefaultSshFuture.java
index a02931a..634eb58 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/future/DefaultSshFuture.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/future/DefaultSshFuture.java
@@ -53,6 +53,7 @@ public class DefaultSshFuture<T extends SshFuture> implements SshFuture<T> {
     /**
      * {@inheritDoc}
      */
+    @Override
     public T await() throws InterruptedException {
         synchronized (lock) {
             while (result == null) {
@@ -65,6 +66,7 @@ public class DefaultSshFuture<T extends SshFuture> implements SshFuture<T> {
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean await(long timeout, TimeUnit unit) throws InterruptedException {
         return await(unit.toMillis(timeout));
     }
@@ -72,6 +74,7 @@ public class DefaultSshFuture<T extends SshFuture> implements SshFuture<T> {
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean await(long timeoutMillis) throws InterruptedException {
         return await0(timeoutMillis, true);
     }
@@ -79,6 +82,7 @@ public class DefaultSshFuture<T extends SshFuture> implements SshFuture<T> {
     /**
      * {@inheritDoc}
      */
+    @Override
     public T awaitUninterruptibly() {
         try {
             await0(Long.MAX_VALUE, false);
@@ -92,6 +96,7 @@ public class DefaultSshFuture<T extends SshFuture> implements SshFuture<T> {
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean awaitUninterruptibly(long timeout, TimeUnit unit) {
         return awaitUninterruptibly(unit.toMillis(timeout));
     }
@@ -99,6 +104,7 @@ public class DefaultSshFuture<T extends SshFuture> implements SshFuture<T> {
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean awaitUninterruptibly(long timeoutMillis) {
         try {
             return await0(timeoutMillis, false);
@@ -150,6 +156,7 @@ public class DefaultSshFuture<T extends SshFuture> implements SshFuture<T> {
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean isDone() {
         synchronized (lock) {
             return result != null;
@@ -185,6 +192,7 @@ public class DefaultSshFuture<T extends SshFuture> implements SshFuture<T> {
     /**
      * {@inheritDoc}
      */
+    @Override
     public T addListener(SshFutureListener<T> listener) {
         if (listener == null) {
             throw new NullPointerException("listener");
@@ -219,6 +227,7 @@ public class DefaultSshFuture<T extends SshFuture> implements SshFuture<T> {
     /**
      * {@inheritDoc}
      */
+    @Override
     public T removeListener(SshFutureListener<T> listener) {
         if (listener == null) {
             throw new NullPointerException("listener");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/7df17efd/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java b/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java
index 378cce6..2706dca 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java
@@ -340,7 +340,9 @@ public abstract class AbstractSession extends CloseableUtils.AbstractInnerClosea
             case SSH_MSG_DISCONNECT: {
                 int code = buffer.getInt();
                 String msg = buffer.getString();
-                log.debug("Received SSH_MSG_DISCONNECT (reason={}, msg={})", code, msg);
+                if (log.isDebugEnabled()) {
+                    log.debug("Received SSH_MSG_DISCONNECT (reason={}, msg={})", Integer.valueOf(code), msg);
+                }
                 close(true);
                 break;
             }
@@ -350,13 +352,17 @@ public abstract class AbstractSession extends CloseableUtils.AbstractInnerClosea
             }
             case SSH_MSG_UNIMPLEMENTED: {
                 int code = buffer.getInt();
-                log.debug("Received SSH_MSG_UNIMPLEMENTED #{}", code);
+                if (log.isDebugEnabled()) {
+                    log.debug("Received SSH_MSG_UNIMPLEMENTED #{}", Integer.valueOf(code));
+                }
                 break;
             }
             case SSH_MSG_DEBUG: {
                 boolean display = buffer.getBoolean();
                 String msg = buffer.getString();
-                log.debug("Received SSH_MSG_DEBUG (display={}) '{}'", display, msg);
+                if (log.isDebugEnabled()) {
+                    log.debug("Received SSH_MSG_DEBUG (display={}) '{}'", Boolean.valueOf(display), msg);
+                }
                 break;
             }
             case SSH_MSG_SERVICE_REQUEST:
@@ -404,7 +410,7 @@ public abstract class AbstractSession extends CloseableUtils.AbstractInnerClosea
                 }
                 receiveNewKeys();
                 if (reexchangeFuture != null) {
-                    reexchangeFuture.setValue(true);
+                    reexchangeFuture.setValue(Boolean.TRUE);
                 }
                 sendEvent(SessionListener.Event.KeyEstablished);
                 synchronized (pendingPackets) {
@@ -546,6 +552,7 @@ public abstract class AbstractSession extends CloseableUtils.AbstractInnerClosea
         final IoWriteFuture writeFuture = writePacket(buffer);
         final DefaultSshFuture<IoWriteFuture> future = (DefaultSshFuture<IoWriteFuture>) writeFuture;
         final ScheduledFuture<?> sched = factoryManager.getScheduledExecutorService().schedule(new Runnable() {
+            @SuppressWarnings("synthetic-access")
             @Override
             public void run() {
                 log.info("Timeout writing packet.");
@@ -659,7 +666,7 @@ public abstract class AbstractSession extends CloseableUtils.AbstractInnerClosea
             int off = buffer.rpos() - 5;
             // Debug log the packet
             if (log.isTraceEnabled()) {
-                log.trace("Sending packet #{}: {}", seqo, buffer.printHex());
+                log.trace("Sending packet #{}: {}", Long.valueOf(seqo), buffer.printHex());
             }
             // Compress the packet if needed
             if (outCompression != null && (authed || !outCompression.isDelayed())) {
@@ -731,7 +738,7 @@ public abstract class AbstractSession extends CloseableUtils.AbstractInnerClosea
                     decoderLength = decoderBuffer.getInt();
                     // Check packet length validity
                     if (decoderLength < 5 || decoderLength > (256 * 1024)) {
-                        log.info("Error decoding packet (invalid length) {}", decoderBuffer.printHex());
+                        log.warn("Error decoding packet (invalid length) {}", decoderBuffer.printHex());
                         throw new SshException(SshConstants.SSH2_DISCONNECT_PROTOCOL_ERROR,
                                                "Invalid packet length: " + decoderLength);
                     }
@@ -787,7 +794,7 @@ public abstract class AbstractSession extends CloseableUtils.AbstractInnerClosea
                         buf = decoderBuffer;
                     }
                     if (log.isTraceEnabled()) {
-                        log.trace("Received packet #{}: {}", seqi, buf.printHex());
+                        log.trace("Received packet #{}: {}", Long.valueOf(seqi), buf.printHex());
                     }
                     // Update stats
                     inPackets ++;
@@ -1189,14 +1196,16 @@ public abstract class AbstractSession extends CloseableUtils.AbstractInnerClosea
         }
         negotiated = guess;
 
-        log.debug("Kex: server->client {} {} {}",
-                new Object[]{negotiated[SshConstants.PROPOSAL_ENC_ALGS_STOC],
-                        negotiated[SshConstants.PROPOSAL_MAC_ALGS_STOC],
-                        negotiated[SshConstants.PROPOSAL_COMP_ALGS_STOC]});
-        log.debug("Kex: client->server {} {} {}",
-                new Object[]{negotiated[SshConstants.PROPOSAL_ENC_ALGS_CTOS],
-                        negotiated[SshConstants.PROPOSAL_MAC_ALGS_CTOS],
-                        negotiated[SshConstants.PROPOSAL_COMP_ALGS_CTOS]});
+        if (log.isDebugEnabled()) {
+            log.debug("Kex: server->client {} {} {}",
+                      new Object[]{negotiated[SshConstants.PROPOSAL_ENC_ALGS_STOC],
+                            negotiated[SshConstants.PROPOSAL_MAC_ALGS_STOC],
+                            negotiated[SshConstants.PROPOSAL_COMP_ALGS_STOC]});
+            log.debug("Kex: client->server {} {} {}",
+                      new Object[]{negotiated[SshConstants.PROPOSAL_ENC_ALGS_CTOS],
+                            negotiated[SshConstants.PROPOSAL_MAC_ALGS_CTOS],
+                            negotiated[SshConstants.PROPOSAL_COMP_ALGS_CTOS]});
+        }
     }
 
     protected void requestSuccess(Buffer buffer) throws Exception{
@@ -1318,6 +1327,7 @@ public abstract class AbstractSession extends CloseableUtils.AbstractInnerClosea
     }
 
     protected void checkRekey() throws IOException {
+        // nothing
     }
 
     protected abstract void sendKexInit() throws IOException;
@@ -1327,6 +1337,7 @@ public abstract class AbstractSession extends CloseableUtils.AbstractInnerClosea
     protected abstract void receiveKexInit(Buffer buffer) throws IOException;
 
     protected void serviceAccept() throws IOException {
+        // nothing
     }
 
     public abstract void startService(String name) throws Exception;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/7df17efd/sshd-core/src/main/java/org/apache/sshd/common/util/CloseableUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/CloseableUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/CloseableUtils.java
index c0242ae..01e02c3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/CloseableUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/CloseableUtils.java
@@ -151,6 +151,13 @@ public class CloseableUtils {
     }
 
     public static abstract class IoBaseCloseable implements Closeable {
+        /** Our logger */
+        protected final Logger log = LoggerFactory.getLogger(getClass());
+        
+        protected IoBaseCloseable() {
+            super();
+        }
+        
         // TODO once JDK 8+ becomes the minimum for this project, make it a default method instead of this class
         @Override
         public void close() throws IOException {
@@ -295,8 +302,6 @@ public class CloseableUtils {
         protected enum State {
             Opened, Graceful, Immediate, Closed
         }
-        /** Our logger */
-        protected final Logger log = LoggerFactory.getLogger(getClass());
         /** Lock object for this session state */
         protected final Object lock = new Object();
         /** State of this object */

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/7df17efd/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 c977c20..b7c86ff 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
@@ -204,6 +204,7 @@ public class ChannelSession extends AbstractServerChannel {
     protected Buffer tempBuffer;
     protected final CloseFuture commandExitFuture = new DefaultCloseFuture(lock);
 
+    @SuppressWarnings("synthetic-access")
     public ChannelSession() {
         addRequestHandler(new ChannelSessionRequestHandler());
         addRequestHandler(new PuttyRequestHandler());
@@ -250,7 +251,7 @@ public class ChannelSession extends AbstractServerChannel {
                 FactoryManager manager = getSession().getFactoryManager();
                 long timeout = FactoryManagerUtils.getLongProperty(manager, ServerFactoryManager.COMMAND_EXIT_TIMEOUT, DEFAULT_COMMAND_EXIT_TIMEOUT);
                 if (log.isDebugEnabled()) {
-                    log.debug("Wait {} ms for shell to exit cleanly", timeout);
+                    log.debug("Wait {} ms for shell to exit cleanly", Long.valueOf(timeout));
                 }
 
                 manager.getScheduledExecutorService().schedule(task, timeout, TimeUnit.MILLISECONDS);
@@ -308,49 +309,49 @@ public class ChannelSession extends AbstractServerChannel {
 
     public Boolean handleRequest(String type, Buffer buffer) throws IOException {
         if ("env".equals(type)) {
-            return handleEnv(buffer);
+            return Boolean.valueOf(handleEnv(buffer));
         }
         if ("pty-req".equals(type)) {
-            return handlePtyReq(buffer);
+            return Boolean.valueOf(handlePtyReq(buffer));
         }
         if ("window-change".equals(type)) {
-            return handleWindowChange(buffer);
+            return Boolean.valueOf(handleWindowChange(buffer));
         }
         if ("signal".equals(type)) {
-            return handleSignal(buffer);
+            return Boolean.valueOf(handleSignal(buffer));
         }
         if ("break".equals(type)) {
-            return handleBreak(buffer);
+            return Boolean.valueOf(handleBreak(buffer));
         }
         if ("shell".equals(type)) {
             if (this.type == null && handleShell(buffer)) {
                 this.type = type;
-                return true;
+                return Boolean.TRUE;
             } else {
-                return false;
+                return Boolean.FALSE;
             }
         }
         if ("exec".equals(type)) {
             if (this.type == null && handleExec(buffer)) {
                 this.type = type;
-                return true;
+                return Boolean.TRUE;
             } else {
-                return false;
+                return Boolean.FALSE;
             }
         }
         if ("subsystem".equals(type)) {
             if (this.type == null && handleSubsystem(buffer)) {
                 this.type = type;
-                return true;
+                return Boolean.TRUE;
             } else {
-                return false;
+                return Boolean.FALSE;
             }
         }
         if ("auth-agent-req@openssh.com".equals(type)) {
-            return handleAgentForwarding(buffer);
+            return Boolean.valueOf(handleAgentForwarding(buffer));
         }
         if ("x11-req".equals(type)) {
-            return handleX11Forwarding(buffer);
+            return Boolean.valueOf(handleX11Forwarding(buffer));
         }
         return null;
     }
@@ -359,7 +360,9 @@ public class ChannelSession extends AbstractServerChannel {
         String name = buffer.getString();
         String value = buffer.getString();
         addEnvVariable(name, value);
-        log.debug("env for channel {}: {} = {}", new Object[] { id, name, value });
+        if (log.isDebugEnabled()) {
+            log.debug("env for channel {}: {} = {}", new Object[] { Integer.valueOf(id), name, value });
+        }
         return true;
     }
 
@@ -387,10 +390,14 @@ public class ChannelSession extends AbstractServerChannel {
                        ((modes[i++] << 16) & 0x00ff0000) |
                        ((modes[i++] <<  8) & 0x0000ff00) |
                        ((modes[i++]) & 0x000000ff);
-            ptyModes.put(mode, val);
+            ptyModes.put(mode, Integer.valueOf(val));
         }
         if (log.isDebugEnabled()) {
-            log.debug("pty for channel {}: term={}, size=({} - {}), pixels=({}, {}), modes=[{}]", new Object[] { id, term, tColumns, tRows, tWidth, tHeight, ptyModes });
+            log.debug("pty for channel {}: term={}, size=({} - {}), pixels=({}, {}), modes=[{}]",
+                      new Object[] { Integer.valueOf(id), term, 
+                                     Integer.valueOf(tColumns), Integer.valueOf(tRows),
+                                     Integer.valueOf(tWidth), Integer.valueOf(tHeight),
+                                     ptyModes });
         }
         addEnvVariable(Environment.ENV_TERM, term);
         addEnvVariable(Environment.ENV_COLUMNS, Integer.toString(tColumns));
@@ -403,7 +410,12 @@ public class ChannelSession extends AbstractServerChannel {
         int tRows = buffer.getInt();
         int tWidth = buffer.getInt();
         int tHeight = buffer.getInt();
-        log.debug("window-change for channel {}: ({} - {}), ({}, {})", new Object[] { id, tColumns, tRows, tWidth, tHeight });
+        if (log.isDebugEnabled()) {
+            log.debug("window-change for channel {}: ({} - {}), ({}, {})",
+                      new Object[] { Integer.valueOf(id),
+                                     Integer.valueOf(tColumns), Integer.valueOf(tRows),
+                                     Integer.valueOf(tWidth), Integer.valueOf(tHeight) });
+        }
 
         final StandardEnvironment e = getEnvironment();
         e.set(Environment.ENV_COLUMNS, Integer.toString(tColumns));
@@ -414,7 +426,9 @@ public class ChannelSession extends AbstractServerChannel {
 
     protected boolean handleSignal(Buffer buffer) throws IOException {
         String name = buffer.getString();
-        log.debug("Signal received on channel {}: {}", id, name);
+        if (log.isDebugEnabled()) {
+            log.debug("Signal received on channel {}: {}", Integer.valueOf(id), name);
+        }
 
         final Signal signal = Signal.get(name);
         if (signal != null) {
@@ -427,7 +441,9 @@ public class ChannelSession extends AbstractServerChannel {
 
     protected boolean handleBreak(Buffer buffer) throws IOException {
         String name = buffer.getString();
-        log.debug("Break received on channel {}: {}", id, name);
+        if (log.isDebugEnabled()) {
+            log.debug("Break received on channel {}: {}", Integer.valueOf(id), name);
+        }
 
         getEnvironment().signal(Signal.INT);
         return true;
@@ -553,6 +569,7 @@ public class ChannelSession extends AbstractServerChannel {
             doWriteData(buffer.array(), buffer.rpos(), buffer.available());
         }
         command.setExitCallback(new ExitCallback() {
+            @SuppressWarnings("synthetic-access")
             @Override
             public void onExit(int exitValue) {
                 try {
@@ -569,8 +586,8 @@ public class ChannelSession extends AbstractServerChannel {
     }
 
     protected int getPtyModeValue(PtyMode mode) {
-        Integer v = getEnvironment().getPtyModes().get(mode);
-        return v != null ? v : 0;
+        Number v = getEnvironment().getPtyModes().get(mode);
+        return v != null ? v.intValue() : 0;
     }
 
     protected boolean handleAgentForwarding(Buffer buffer) throws IOException {
@@ -629,7 +646,7 @@ public class ChannelSession extends AbstractServerChannel {
             if (r == null) {
                 return Result.Unsupported;
             } else {
-                return r ? Result.ReplySuccess : Result.ReplyFailure;
+                return r.booleanValue() ? Result.ReplySuccess : Result.ReplyFailure;
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/7df17efd/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
index f31851a..c0ec866 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
@@ -143,7 +143,10 @@ public class ServerUserAuthService extends CloseableUtils.AbstractCloseable impl
                 return;
             }
 
-            log.debug("Authenticating user '{}' with service '{}' and method '{}'", new Object[] { username, service, method });
+            if (log.isDebugEnabled()) {
+                log.debug("Authenticating user '{}' with service '{}' and method '{}'",
+                          new Object[] { username, service, method });
+            }
             NamedFactory<UserAuth> factory = NamedFactory.Utils.get(userAuthFactories, method);
             if (factory != null) {
                 currentAuth = factory.create();