vijayto / sshxcute

Automatically exported from code.google.com/p/sshxcute
0 stars 0 forks source link

In appropriate Error Message Handling #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run command datee
2. Run custom command ns

What is the expected output? What do you see instead?
Case 1:- The Result as isSuccess as false and errorMsg = bash Command not 
found, sysout has ""
Case 2:- The Result as isSuccess as false and errorMsg = "" and sysout the 
exception trace.

What version of the product are you using? On what operating system?
Latest version on unix

Please provide any additional information below.

In SSHExec class method exec(CustomTask task)

should not be the code as mentioned below.

 //r.sysout = sb.toString();
if (task.isSuccess(sb.toString(), channel.getExitStatus())) {
    r.error_msg = "";
    r.isSuccess = true;
    r.sysout = sb.toString();
} else {
    r.error_msg = SSHExecUtil.getErrorMsg(SysConfigOption.ERROR_MSG_BUFFER_TEMP_FILE_PATH);
    if( r.error_msg == null ) {
        r.error_msg = sb.toString();
        r.sysout = "";
    }
    r.isSuccess = false;
    logger.putMsg(Logger.INFO,"Execution failed while executing command: " + task.getCommand());
    logger.putMsg(Logger.INFO,"Error message: " + r.error_msg);
    if (SysConfigOption.HALT_ON_FAILURE)
    {
        logger.putMsg(Logger.ERROR,"The task has failed to execute :" + task.getInfo() + ". So program exit.");
        throw new TaskExecFailException(task.getInfo());
    }
}

Original issue reported on code.google.com by jaladi.p...@gmail.com on 27 Apr 2012 at 7:25