Repository: mina-sshd
Updated Branches:
  refs/heads/master e0e66e713 -> d6bd4add0


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/main/java/org/apache/sshd/server/session/ServerSessionImpl.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerSessionImpl.java 
b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerSessionImpl.java
index 32ae420..8e6343c 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerSessionImpl.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerSessionImpl.java
@@ -27,6 +27,7 @@ import java.util.Objects;
 import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.NamedResource;
 import org.apache.sshd.common.PropertyResolverUtils;
+import org.apache.sshd.common.RuntimeSshException;
 import org.apache.sshd.common.ServiceFactory;
 import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.SshException;
@@ -59,7 +60,16 @@ public class ServerSessionImpl extends AbstractServerSession 
{
 
         // Inform the listener of the newly created session
         SessionListener listener = getSessionListenerProxy();
-        listener.sessionCreated(this);
+        try {
+            listener.sessionCreated(this);
+        } catch (Throwable t) {
+            Throwable e = GenericUtils.peelException(t);
+            if (e instanceof Exception) {
+                throw (Exception) e;
+            } else {
+                throw new RuntimeSshException(e);
+            }
+        }
 
         sendServerIdentification();
     }
@@ -118,7 +128,19 @@ public class ServerSessionImpl extends 
AbstractServerSession {
 
         KeyPairProvider kpp = getKeyPairProvider();
         Collection<String> supported = 
NamedResource.Utils.getNameList(getSignatureFactories());
-        Iterable<String> provided = (kpp == null) ? null : kpp.getKeyTypes();
+        Iterable<String> provided;
+        try {
+            provided = (kpp == null) ? null : kpp.getKeyTypes();
+        } catch (Error e) {
+            log.warn("resolveAvailableSignaturesProposal({}) failed ({}) to 
get key types: {}",
+                     this, e.getClass().getSimpleName(), e.getMessage());
+            if (log.isDebugEnabled()) {
+                log.debug("resolveAvailableSignaturesProposal(" + this + ") 
fetch key types failure details", e);
+            }
+
+            throw new RuntimeSshException(e);
+        }
+
         if ((provided == null) || GenericUtils.isEmpty(supported)) {
             return resolveEmptySignaturesProposal(supported, provided);
         }
@@ -203,9 +225,19 @@ public class ServerSessionImpl extends 
AbstractServerSession {
 
     @Override
     public KeyPair getHostKey() {
-        String value = getNegotiatedKexParameter(KexProposalOption.SERVERKEYS);
+        String keyType = 
getNegotiatedKexParameter(KexProposalOption.SERVERKEYS);
         KeyPairProvider provider = 
ValidateUtils.checkNotNull(getKeyPairProvider(), "No host keys provider");
-        return provider.loadKey(value);
+        try {
+            return provider.loadKey(keyType);
+        } catch (Error e) {
+            log.warn("getHostKey({}) failed ({}) to load key of type={}: {}",
+                     this, e.getClass().getSimpleName(), keyType, 
e.getMessage());
+            if (log.isDebugEnabled()) {
+                log.debug("getHostKey(" + this + ") " + keyType + " key load 
failure details", e);
+            }
+
+            throw new RuntimeSshException(e);
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/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 518b319..46e3128 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
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.NamedResource;
 import org.apache.sshd.common.PropertyResolverUtils;
@@ -159,16 +160,19 @@ public class ServerUserAuthService extends 
AbstractCloseable implements Service,
                           session, username, service, method, nbAuthRequests, 
maxAuthRequests);
             }
 
-            NamedFactory<UserAuth> factory = 
NamedResource.Utils.findByName(method, String.CASE_INSENSITIVE_ORDER, 
userAuthFactories);
+            Factory<UserAuth> factory = NamedResource.Utils.findByName(method, 
String.CASE_INSENSITIVE_ORDER, userAuthFactories);
             if (factory != null) {
                 currentAuth = ValidateUtils.checkNotNull(factory.create(), "No 
authenticator created for method=%s", method);
                 try {
                     authed = currentAuth.auth(session, username, service, 
buffer);
                 } catch (Exception e) {
                     if (log.isDebugEnabled()) {
-                        log.debug("process({}) Failed ({}) to authenticate 
using method={}: {}",
+                        log.debug("process({}) Failed ({}) to authenticate 
using factory method={}: {}",
                                   session, e.getClass().getSimpleName(), 
method, e.getMessage());
                     }
+                    if (log.isTraceEnabled()) {
+                        log.trace("process(" + session + ") factory 
authentication=" + method + " failure details", e);
+                    }
                 }
             } else {
                 if (log.isDebugEnabled()) {
@@ -192,11 +196,11 @@ public class ServerUserAuthService extends 
AbstractCloseable implements Service,
             } catch (Exception e) {
                 // Continue
                 if (log.isDebugEnabled()) {
-                    log.debug("process({}) Failed ({}) to authenticate using 
method={}: {}",
+                    log.debug("process({}) Failed ({}) to authenticate using 
current method={}: {}",
                               session, e.getClass().getSimpleName(), 
currentAuth.getName(), e.getMessage());
                 }
                 if (log.isTraceEnabled()) {
-                    log.trace("process(" + session + ") " + 
currentAuth.getName() + " failure details", e);
+                    log.trace("process(" + session + ") current 
authentiaction=" + currentAuth.getName() + " failure details", e);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
 
b/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
index 5060c18..189dae1 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
@@ -25,6 +25,7 @@ import java.util.concurrent.Executor;
 import java.util.concurrent.ExecutorService;
 
 import org.apache.sshd.common.PropertyResolverUtils;
+import org.apache.sshd.common.RuntimeSshException;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.io.IoUtils;
@@ -159,10 +160,10 @@ public class InvertedShellWrapper extends 
AbstractLoggingBean implements Command
 
     @Override
     public synchronized void destroy() throws Exception {
-        Exception err = null;
+        Throwable err = null;
         try {
             shell.destroy();
-        } catch (Exception e) {
+        } catch (Throwable e) {
             log.warn("destroy({}) failed ({}) to destroy shell: {}",
                      this, e.getClass().getSimpleName(), e.getMessage());
             if (log.isDebugEnabled()) {
@@ -185,7 +186,11 @@ public class InvertedShellWrapper extends 
AbstractLoggingBean implements Command
         }
 
         if (err != null) {
-            throw err;
+            if (err instanceof Exception) {
+                throw (Exception) err;
+            } else {
+                throw new RuntimeSshException(err);
+            }
         }
     }
 
@@ -219,10 +224,10 @@ public class InvertedShellWrapper extends 
AbstractLoggingBean implements Command
                 // method would consume at least two threads
                 Thread.sleep(pumpSleepTime);
             }
-        } catch (Exception e) {
+        } catch (Throwable e) {
             try {
                 shell.destroy();
-            } catch (Exception err) {
+            } catch (Throwable err) {
                 log.warn("pumpStreams({}) failed ({}) to destroy shell: {}",
                          this, e.getClass().getSimpleName(), e.getMessage());
                 if (log.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/main/java/org/apache/sshd/server/x11/X11ForwardSupport.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/server/x11/X11ForwardSupport.java 
b/sshd-core/src/main/java/org/apache/sshd/server/x11/X11ForwardSupport.java
index b6eebad..9f90614 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/x11/X11ForwardSupport.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/x11/X11ForwardSupport.java
@@ -139,7 +139,7 @@ public class X11ForwardSupport extends 
AbstractInnerCloseable implements IoHandl
                     p = new ProcessBuilder(XAUTH_COMMAND, "add", authDisplay, 
authenticationProtocol, authenticationCookie).start();
                     result = p.waitFor();
                 }
-            } catch (Exception e) {
+            } catch (Throwable e) {
                 log.error("Could not run xauth", e);
                 return null;
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/test/java/org/apache/sshd/agent/AgentTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/agent/AgentTest.java 
b/sshd-core/src/test/java/org/apache/sshd/agent/AgentTest.java
index fbdc82b..a906c55 100644
--- a/sshd-core/src/test/java/org/apache/sshd/agent/AgentTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/agent/AgentTest.java
@@ -65,9 +65,14 @@ public class AgentTest extends BaseTestSupport {
             String authSocket;
             try {
                 authSocket = agent.start();
-            } catch (UnsatisfiedLinkError e) {
-                // the native library is not available, so these tests should 
be skipped
-                authSocket = null;
+            } catch (RuntimeException e) {
+                Throwable cause = e.getCause();
+                if (cause instanceof UnsatisfiedLinkError) {
+                    // the native library is not available, so these tests 
should be skipped
+                    authSocket = null;
+                } else {
+                    throw e;
+                }
             }
             Assume.assumeTrue("Native library N/A", authSocket != null);
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java 
b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
index 1572978..589b0df 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
@@ -383,7 +383,9 @@ public class ClientTest extends BaseTestSupport {
                         eventsMap.remove("Closed"); // since it is called 
anyway but does not cause an IOException
                         assertTrue("Unexpected failure at retry #" + 
retryCount, eventsMap.size() < 3);
                     }
-                } catch(IllegalStateException e) {
+                } catch (ChannelFailureException e) {
+                    assertEquals("Mismatched failure reason", "Initialized", 
e.getMessage());
+                } catch (IllegalStateException e) {
                     // sometimes due to timing issues we get this problem
                     assertTrue("Premature exception phase - count=" + 
retryCount, retryCount > 0);
                     assertTrue("Session not closing", session.isClosing() || 
session.isClosed());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/HostConfigEntryTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/HostConfigEntryTest.java
 
b/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/HostConfigEntryTest.java
index fe43b62..d86a565 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/HostConfigEntryTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/HostConfigEntryTest.java
@@ -256,7 +256,7 @@ public class HostConfigEntryTest extends BaseTestSupport {
             try {
                 String result = 
HostConfigEntry.resolveIdentityFilePath(pattern, HOST, PORT, USER);
                 System.out.append('\t').append(pattern).append(" => 
").println(result);
-            } catch(Exception e) {
+            } catch (Exception e) {
                 System.err.append("Failed 
(").append(e.getClass().getSimpleName())
                           .append(") to process pattern=").append(pattern)
                           .append(": ").println(e.getMessage());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
 
b/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
index 4076933..11aa720 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSessionClientTest.java
@@ -97,7 +97,7 @@ public class SimpleSessionClientTest extends 
BaseSimpleClientTestSupport {
             public void sessionCreated(Session session) {
                 try {
                     Thread.sleep(CONNECT_TIMEOUT + 150L);
-                } catch(InterruptedException e) {
+                } catch (InterruptedException e) {
                     // ignored
                 }
             }
@@ -112,7 +112,7 @@ public class SimpleSessionClientTest extends 
BaseSimpleClientTestSupport {
         long nanoStart = System.nanoTime();
         try(ClientSession session = simple.sessionLogin(TEST_LOCALHOST, port, 
getCurrentTestName(), getCurrentTestName())) {
             fail("Unexpected connection success");
-        } catch(IOException e) {
+        } catch (IOException e) {
             long nanoEnd = System.nanoTime();
             long nanoDuration = nanoEnd - nanoStart;
             long nanoTimeout = TimeUnit.MILLISECONDS.toNanos(CONNECT_TIMEOUT);
@@ -131,7 +131,7 @@ public class SimpleSessionClientTest extends 
BaseSimpleClientTestSupport {
             public boolean authenticate(String username, String password, 
ServerSession session) {
                 try {
                     Thread.sleep(AUTH_TIMEOUT + 150L);
-                } catch(InterruptedException e) {
+                } catch (InterruptedException e) {
                     // ignored
                 }
                 return delegate.authenticate(username, password, session);
@@ -142,7 +142,7 @@ public class SimpleSessionClientTest extends 
BaseSimpleClientTestSupport {
         long nanoStart = System.nanoTime();
         try(ClientSession session = simple.sessionLogin(TEST_LOCALHOST, port, 
getCurrentTestName(), getCurrentTestName())) {
             fail("Unexpected connection success");
-        } catch(IOException e) {
+        } catch (IOException e) {
             long nanoEnd = System.nanoTime();
             long nanoDuration = nanoEnd - nanoStart;
             long nanoTimeout = TimeUnit.MILLISECONDS.toNanos(AUTH_TIMEOUT);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java 
b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java
index bcf820e..d111225 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpTest.java
@@ -290,7 +290,7 @@ public class SftpTest extends AbstractSftpClientTestSupport 
{
                 try (SftpClient sftp = session.createSftpClient()) {
                     SftpClient.Attributes attrs = sftp.stat(escapePath);
                     fail("Unexpected escape success for path=" + escapePath + 
": " + attrs);
-                } catch(SftpException e) {
+                } catch (SftpException e) {
                     if (OsUtils.isWin32()) {
                         assertEquals("Mismatched status for " + escapePath,
                                      
SftpConstants.getStatusName(SftpConstants.SSH_FX_INVALID_FILENAME),
@@ -1146,7 +1146,7 @@ public class SftpTest extends 
AbstractSftpClientTestSupport {
                 PropertyResolverUtils.updateProperty(session, 
SftpClient.SFTP_CHANNEL_OPEN_TIMEOUT, TimeUnit.SECONDS.toMillis(4L));
                 try (SftpClient sftp = session.createSftpClient()) {
                     fail("Unexpected SFTP client creation success");
-                } catch(SocketTimeoutException | EOFException | 
WindowClosedException e) {
+                } catch (SocketTimeoutException | EOFException | 
WindowClosedException e) {
                     // expected - ignored
                 }
             } finally {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java
 
b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java
index 640d1b8..02a0533 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionSelectorTest.java
@@ -88,7 +88,7 @@ public class SftpVersionSelectorTest extends BaseTestSupport {
                     int actual = selector.selectVersion(version, unavailable);
                     fail("Unexpected selected version (" + actual + ")"
                        + " for current= " + version + ", available=" + 
unavailable + ", preferred=" + preferred);
-                } catch(IllegalStateException e) {
+                } catch (IllegalStateException e) {
                     // expected
                 }
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
 
b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
index bd1e61e..ab9d74c 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
@@ -376,7 +376,7 @@ public class SftpVersionsTest extends 
AbstractSftpClientTestSupport {
                         try {
                             super.setFileExtensions(file, extensions, options);
                             assertFalse("Expected exception not generated for 
version=" + currentVersion, currentVersion >= SftpConstants.SFTP_V6);
-                        } catch(UnsupportedOperationException e) {
+                        } catch (UnsupportedOperationException e) {
                             assertTrue("Unexpected exception for version=" + 
currentVersion, currentVersion >= SftpConstants.SFTP_V6);
                         }
                     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java 
b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
index 47a5934..a245518 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
@@ -574,6 +574,9 @@ public class AuthenticationTest extends BaseTestSupport {
                 assertFalse("Unexpected authentication success", 
future.isSuccess());
 
                 Throwable actual = future.getException();
+                if (actual instanceof IOException) {
+                    actual = actual.getCause();
+                }
                 assertSame("Mismatched authentication failure reason", 
expected, actual);
             } finally {
                 client.stop();
@@ -705,7 +708,7 @@ public class AuthenticationTest extends BaseTestSupport {
                         s.auth().verify(17L, TimeUnit.SECONDS);
                         assertEquals("Mismatched number of challenges", 3, 
challengeCounter.get());
                         break;
-                    } catch(SshException e) {   // expected
+                    } catch (SshException e) {   // expected
                         outputDebugMessage("%s on retry #%d: %s", 
e.getClass().getSimpleName(), index, e.getMessage());
 
                         Throwable t = e.getCause();
@@ -757,6 +760,63 @@ public class AuthenticationTest extends BaseTestSupport {
         }
     }
 
+    @Test   // see SSHD-625
+    public void testRuntimeErrorsInAuthenticators() throws Exception {
+        final Error thrown = new OutOfMemoryError(getCurrentTestName());
+        final PasswordAuthenticator authPassword = 
sshd.getPasswordAuthenticator();
+        final AtomicInteger passCounter = new AtomicInteger(0);
+        sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
+            @Override
+            public boolean authenticate(String username, String password, 
ServerSession session)
+                    throws PasswordChangeRequiredException {
+                int count = passCounter.incrementAndGet();
+                if (count == 1) {
+                    throw thrown;
+                }
+                return authPassword.authenticate(username, password, session);
+            }
+        });
+
+        final PublickeyAuthenticator authPubkey = 
sshd.getPublickeyAuthenticator();
+        final AtomicInteger pubkeyCounter = new AtomicInteger(0);
+        sshd.setPublickeyAuthenticator(new PublickeyAuthenticator() {
+            @Override
+            public boolean authenticate(String username, PublicKey key, 
ServerSession session) {
+                int count = pubkeyCounter.incrementAndGet();
+                if (count == 1) {
+                    throw thrown;
+                }
+                return authPubkey.authenticate(username, key, session);
+            }
+        });
+        
sshd.setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator.NONE);
+
+        try (SshClient client = setupTestClient()) {
+            KeyPair kp = Utils.generateKeyPair("RSA", 1024);
+            client.start();
+            try {
+                for (int index = 1; index < 3; index++) {
+                    try (ClientSession s = 
client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, 
TimeUnit.SECONDS).getSession()) {
+                        s.addPasswordIdentity(getCurrentTestName());
+                        s.addPublicKeyIdentity(kp);
+
+                        AuthFuture auth = s.auth();
+                        assertTrue("Failed to complete authentication on 
time", auth.await(11L, TimeUnit.SECONDS));
+                        if (auth.isSuccess()) {
+                            assertTrue("Premature authentication success", 
index > 1);
+                            break;
+                        }
+
+                        assertEquals("Password authenticator not consulted", 
1, passCounter.get());
+                        assertEquals("Pubkey authenticator not consulted", 1, 
pubkeyCounter.get());
+                    }
+                }
+            } finally {
+                client.stop();
+            }
+        }
+    }
+
     private static void assertAuthenticationResult(String message, AuthFuture 
future, boolean expected) throws IOException {
         assertTrue(message + ": failed to get result on time", 
future.await(5L, TimeUnit.SECONDS));
         assertEquals(message + ": mismatched authentication result", expected, 
future.isSuccess());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-core/src/test/java/org/apache/sshd/common/config/keys/PublicKeyEntryTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/PublicKeyEntryTest.java
 
b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/PublicKeyEntryTest.java
index b6f0448..bd432f2 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/common/config/keys/PublicKeyEntryTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/common/config/keys/PublicKeyEntryTest.java
@@ -51,7 +51,7 @@ public class PublicKeyEntryTest extends BaseTestSupport {
                 PublicKey key = entry.resolvePublicKey(resolver);
                 assertSame("Mismatched successful resolver", 
PublicKeyEntryResolver.IGNORING, resolver);
                 assertNull("Unexpected success for resolver=" + resolver + ": 
" + KeyUtils.getFingerPrint(key), key);
-            } catch(GeneralSecurityException e) {
+            } catch (GeneralSecurityException e) {
                 assertObjectInstanceOf("Mismatched thrown exception for 
resolver=" + resolver, InvalidKeySpecException.class, e);
             }
         }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/d6bd4add/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
 
b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
index eb115ea..f60ca32 100644
--- 
a/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
+++ 
b/sshd-ldap/src/test/java/org/apache/sshd/server/auth/BaseAuthenticatorTest.java
@@ -163,7 +163,7 @@ public abstract class BaseAuthenticatorTest extends 
BaseTestSupport {
         try {
             ldapServer.start();
             log.info("LDAP server started");
-        } catch(Exception e) {
+        } catch (Exception e) {
             log.error("Failed (" + e.getClass().getSimpleName() + ") to start 
LDAP server: " + e.getMessage(), e);
             e.printStackTrace(System.err);
             stopApacheDs(directoryService);

Reply via email to