mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8322417: Console read line with zero out should zero out when throwing exception
Reviewed-by: mbaesken, stuefe, naoto
This commit is contained in:
parent
7db69e6a12
commit
2f917bff5c
1 changed files with 10 additions and 1 deletions
|
@ -119,9 +119,18 @@ public final class JdkConsoleImpl implements JdkConsole {
|
|||
else
|
||||
ioe.addSuppressed(x);
|
||||
}
|
||||
if (ioe != null)
|
||||
if (ioe != null) {
|
||||
java.util.Arrays.fill(passwd, ' ');
|
||||
try {
|
||||
if (reader instanceof LineReader lr) {
|
||||
lr.zeroOut();
|
||||
}
|
||||
} catch (IOException x) {
|
||||
// ignore
|
||||
}
|
||||
throw ioe;
|
||||
}
|
||||
}
|
||||
pw.println();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue