Added fallback for IDE case
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
parent
0a2846d7f2
commit
3434fcae70
|
@ -49,9 +49,19 @@ class FormUtil {
|
||||||
* @return the entered password
|
* @return the entered password
|
||||||
*/
|
*/
|
||||||
static String readPassword() {
|
static String readPassword() {
|
||||||
String password;
|
String password = "";
|
||||||
System.out.print("Password: ");
|
System.out.print("Password: ");
|
||||||
password = String.valueOf(System.console().readPassword());
|
if (System.console() != null) {
|
||||||
|
password = String.valueOf(System.console().readPassword());
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
password = stdin.readLine();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue