diff --git a/kona-pkix/src/main/java/com/tencent/kona/sun/security/tools/keytool/Main.java b/kona-pkix/src/main/java/com/tencent/kona/sun/security/tools/keytool/Main.java index d83834e5..73ea8e7a 100644 --- a/kona-pkix/src/main/java/com/tencent/kona/sun/security/tools/keytool/Main.java +++ b/kona-pkix/src/main/java/com/tencent/kona/sun/security/tools/keytool/Main.java @@ -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 @@ -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;