Skip to content

Commit

Permalink
Backport ddc909d6a4ac51c4d589d6a7e9c943464dbfe3c2
Browse files Browse the repository at this point in the history
  • Loading branch information
GoeLin committed Dec 29, 2023
1 parent 96057c1 commit d090462
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/java.base/share/classes/java/io/Console.java
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,18 @@ public char[] readPassword(String fmt, Object ... args) {
else
ioe.addSuppressed(x);
}
if (ioe != null)
if (ioe != null) {
java.util.Arrays.fill(passwd, ' ');
try {
if (reader instanceof LineReader) {
LineReader lr = (LineReader)reader;
lr.zeroOut();
}
} catch (IOException x) {
// ignore
}
throw ioe;
}
}
pw.println();
}
Expand Down

0 comments on commit d090462

Please sign in to comment.