[SSHD-233] Provide better error messages instead of "Unable to negociate key 
exchange for item 2"

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

Branch: refs/heads/master
Commit: 0bc4246a4e41aa33d869e4a8ae01544eecd9bd62
Parents: feb2464
Author: Guillaume Nodet <[email protected]>
Authored: Wed Jul 17 16:59:02 2013 +0200
Committer: Guillaume Nodet <[email protected]>
Committed: Wed Jul 17 16:59:02 2013 +0200

----------------------------------------------------------------------
 .../apache/sshd/common/session/AbstractSession.java    | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/0bc4246a/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 2ba5532..a8c26b2 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
@@ -944,7 +944,18 @@ public abstract class AbstractSession implements Session {
                 }
             }
             if (guess[i] == null && i != SshConstants.PROPOSAL_LANG_CTOS && i 
!= SshConstants.PROPOSAL_LANG_STOC) {
-                throw new IllegalStateException("Unable to negociate key 
exchange for item " + i);
+                final String[] items = new String[] {
+                    "kex algorithms",
+                    "server host key algorithms",
+                    "encryption algorithms (client to server)",
+                    "encryption algorithms (server to client)",
+                    "mac algorithms (client to server)",
+                    "mac algorithms (server to client)",
+                    "compression algorithms (client to server)",
+                    "compression algorithms (server to client)"
+                };
+                throw new IllegalStateException("Unable to negociate key 
exchange for " + items[i] +
+                        " (client: " + clientProposal[i] + " / server: " + 
serverProposal[i] + ")");
             }
         }
         negociated = guess;

Reply via email to