Exemple #1
0
 public static MKeyProtect getMKeyProtect(byte code) {
   for (MKeyProtect key : MKeyProtect.values()) {
     if (key.code == code) {
       return key;
     }
   }
   throw new IllegalArgumentException(
       "Unsupported MKeyProtect " + StringUtils.byteHexString(code));
 }
  /*
   * (non-Javadoc)
   *
   * @see
   * com.intel.stl.ui.console.IConsoleEventListener#onConnectFail(java.lang
   * .Exception)
   */
  @Override
  public void onConnectFail(ConsoleTerminalController console, int reason, Exception e) {

    if (e instanceof NumberFormatException) {
      consoleLogin.showMessage(
          UILabels.STL80002_INVALID_PORT_NUMBER.getDescription(defaultLoginBean.getPortNum()));

    } else if (e instanceof JSchException) {
      String msg = new String();
      if (e.getMessage().compareTo("Auth fail") == 0) {
        msg = UILabels.STL80003_AUTHENTICATION_FAILURE.getDescription();

      } else if (e.getMessage().startsWith("SSH_MSG_DISCONNECT")) {
        msg = e.getMessage();

      } else {
        msg =
            UILabels.STL80001_CONSOLE_CONNECTION_ERROR.getDescription()
                + " "
                + consoleLogin.getHostName()
                + ": "
                + e.getMessage();
      }
      consoleLogin.showMessage(msg);
    } else {
      consoleLogin.showMessage(StringUtils.getErrorMessage(e));
    }

    consoleLogin.killProgress();
    tabListener.enableNewTab(true);
    consoleTerminalView.enableCommanding(true);
    if ((console != null) && (reason == REASON_INIT)) {
      console.shutDownConsole();
      closeChannel(console);
      closeSession(console);
    }
  }