Skip to content

Commit

Permalink
TKSS-881: Backport JDK-8339347: keytool -importpass insists prompting…
Browse files Browse the repository at this point in the history
… the user even if there is no terminal
  • Loading branch information
johnshajiang committed Oct 15, 2024
1 parent 48db950 commit 5f0a8db
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1816,7 +1816,8 @@ private char[] promptForKeyPass(String alias, String orig, char[] origPass) thro
*/
private char[] promptForCredential() throws Exception {
// Handle password supplied via stdin
if (System.console() == null) {
Console console = System.console();
if (console == null) { // || !console.isTerminal()
char[] importPass = Password.readPassword(System.in);
passwords.add(importPass);
return importPass;
Expand Down

0 comments on commit 5f0a8db

Please sign in to comment.