}
catch (IOException ex) {
log.warn("Error while executing ssh EXECUTION");
String errorMessage = ex.getMessage();
if (null == errorMessage) { // Unknown IOException
throw new ActionExecutorException(ActionExecutorException.ErrorType.ERROR, ERR_UNKNOWN_ERROR, ex
.getMessage(), ex);
} // Host Resolution Issues
else {
if (errorMessage.contains("Could not resolve hostname") ||
errorMessage.contains("service not known")) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.TRANSIENT, ERR_HOST_RESOLUTION, ex
.getMessage(), ex);
} // Connection Timeout. Host temporarily down.
else {
if (errorMessage.contains("timed out")) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.TRANSIENT, ERR_COULD_NOT_CONNECT,
ex.getMessage(), ex);
}// Local ssh-base or ssh-wrapper missing
else {
if (errorMessage.contains("Required Local file")) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.TRANSIENT, ERR_FNF,
ex.getMessage(), ex); // local_FNF
}// Required oozie bash scripts missing, after the copy was
// successful
else {
if (errorMessage.contains("No such file or directory")
&& (errorMessage.contains("ssh-base") || errorMessage.contains("ssh-wrapper"))) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.TRANSIENT, ERR_FNF,
ex.getMessage(), ex); // remote
// FNF
} // Required application execution binary missing (either
// caught by ssh-wrapper
else {
if (errorMessage.contains("command not found")) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.NON_TRANSIENT, ERR_FNF, ex
.getMessage(), ex); // remote
// FNF
} // Permission denied while connecting
else {
if (errorMessage.contains("Permission denied")) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.NON_TRANSIENT, ERR_AUTH_FAILED, ex
.getMessage(), ex);
} // Permission denied while executing
else {
if (errorMessage.contains(": Permission denied")) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.NON_TRANSIENT, ERR_NO_EXEC_PERM, ex
.getMessage(), ex);
}
else {
throw new ActionExecutorException(ActionExecutorException.ErrorType.ERROR, ERR_UNKNOWN_ERROR, ex
.getMessage(), ex);
}
}
}
}