From b71fea319445437b6ee95758641a81ce977bacbc Mon Sep 17 00:00:00 2001 From: duke Date: Tue, 19 Dec 2023 10:48:51 +0000 Subject: [PATCH] Backport 4ed38f5ad5f822ab948257ed39717ea919fd32ed --- .../jdk/internal/org/jline/JdkConsoleProviderImpl.java | 2 +- .../classes/jdk/internal/org/jline/reader/LineReader.java | 5 +++++ .../jdk/internal/org/jline/reader/impl/LineReaderImpl.java | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/JdkConsoleProviderImpl.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/JdkConsoleProviderImpl.java index 5b1b965d55b..f8946763110 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/JdkConsoleProviderImpl.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/JdkConsoleProviderImpl.java @@ -112,7 +112,7 @@ public char[] readPassword(String fmt, Object ... args) { } catch (EndOfFileException eofe) { return null; } finally { - jline.getBuffer().zeroOut(); + jline.zeroOut(); } } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java index 03729853ca5..bc719e9b46a 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java @@ -750,4 +750,9 @@ enum SuggestionType { void setAutosuggestion(SuggestionType type); SuggestionType getAutosuggestion(); + + // JDK specific modification + default void zeroOut() { + throw new UnsupportedOperationException(); + } } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java index ee8a434e1a2..a41f7d19bf8 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java @@ -6250,4 +6250,10 @@ private void rebind(KeyMap keyMap, String operation, String prevBinding } } + // JDK specific modification + @Override + public void zeroOut() { + buf.zeroOut(); + parsedLine = null; + } }