温释翔
2016-07-22 09:34:52 UTC
Hi,
I am reading code of below method and found there is one exception thrown with little information which is not helpful for end users.
com.jcraft.jsch.Session.connect(int)
while (true) {
buf = read(buf);
if (kex.getState() == buf.getCommand()) {
kex_start_time = System.currentTimeMillis();
boolean result = kex.next(buf);
if (!result) {
//System.err.println("verify: "+result);
in_kex = false;
throw new JSchException("verify: " + result);
}
} else {
in_kex = false;
throw new JSchException("invalid protocol(kex): " + buf.getCommand());
}
if (kex.getState() == KeyExchange.STATE_END) {
break;
}
}
The JSchException("verify:"+result) will result in below stack trace when it is thrown:
Caused by: com.jcraft.jsch.JSchException: verify: false at com.jcraft.jsch.Session.connect(Session.java:305) at com.jcraft.jsch.Session.connect(Session.java:158) at com.ericsson.commonlibrary.nealservices.fault.NodeSftp.connect(NodeSftp.java:44) ... 37 more
This kind of exception message is almost useless for end users, especially for those newbies. So, could you please refine this and make it more readable and understandable? Thanks!
I am reading code of below method and found there is one exception thrown with little information which is not helpful for end users.
com.jcraft.jsch.Session.connect(int)
while (true) {
buf = read(buf);
if (kex.getState() == buf.getCommand()) {
kex_start_time = System.currentTimeMillis();
boolean result = kex.next(buf);
if (!result) {
//System.err.println("verify: "+result);
in_kex = false;
throw new JSchException("verify: " + result);
}
} else {
in_kex = false;
throw new JSchException("invalid protocol(kex): " + buf.getCommand());
}
if (kex.getState() == KeyExchange.STATE_END) {
break;
}
}
The JSchException("verify:"+result) will result in below stack trace when it is thrown:
Caused by: com.jcraft.jsch.JSchException: verify: false at com.jcraft.jsch.Session.connect(Session.java:305) at com.jcraft.jsch.Session.connect(Session.java:158) at com.ericsson.commonlibrary.nealservices.fault.NodeSftp.connect(NodeSftp.java:44) ... 37 more
This kind of exception message is almost useless for end users, especially for those newbies. So, could you please refine this and make it more readable and understandable? Thanks!