Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8332084: Ensure JdkConsoleImpl.restoreEcho visibility in a shutdown hook #19184

Closed
wants to merge 12 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public char[] readPassword(String fmt, Object ... args) {
if (reader instanceof LineReader lr) {
lr.zeroOut();
}
} catch (IOException x) {
} catch (IOException _) {
// ignore
}
throw ioe;
Expand All @@ -152,10 +152,10 @@ public void run() {
if (restoreEcho) {
echo(true);
}
} catch (IOException x) { }
} catch (IOException _) { }
}
});
} catch (IllegalStateException e) {
} catch (IllegalStateException _) {
// shutdown is already in progress and readPassword is first used
// by a shutdown hook
}
Expand Down Expand Up @@ -185,7 +185,7 @@ public Charset charset() {
private final PrintWriter pw;
private final Formatter formatter;
private char[] rcb;
private boolean restoreEcho;
private volatile boolean restoreEcho;
private boolean shutdownHookInstalled;

private char[] readline(boolean zeroOut) throws IOException {
Expand Down