private static String readPassword()

in command.line/java/com/jetbrains/teamcity/Util.java [313:330]


  private static String readPassword(final String prompt) {
    try {
      final Method method = System.class.getDeclaredMethod("console");
      if (method != null) {
        final Object consoleObj = method.invoke(null);
        if (consoleObj != null) {
          final Method passwdMthd = consoleObj.getClass().getMethod("readPassword", String.class, Object[].class);
          if (passwdMthd != null) {
            final char[] passwd = (char[]) passwdMthd.invoke(consoleObj, "%s", new Object[] { prompt });
            return new String(passwd);
          }
        }
      }
    } catch (Throwable e) {
      // do nothing
    }
    return readConsoleInput(prompt, false);// read anyway
  }