8321409: Console read line with zero out should zero out underlying buffer in JLine (redux)

Reviewed-by: alanb
This commit is contained in:
Naoto Sato 2023-12-07 19:46:18 +00:00
parent fe4c0a2f04
commit 4ed38f5ad5
3 changed files with 12 additions and 1 deletions
src/jdk.internal.le/share/classes/jdk/internal/org/jline

@ -114,7 +114,7 @@ public class JdkConsoleProviderImpl implements JdkConsoleProvider {
} catch (EndOfFileException eofe) {
return null;
} finally {
jline.getBuffer().zeroOut();
jline.zeroOut();
}
}

@ -750,4 +750,9 @@ public interface LineReader {
void setAutosuggestion(SuggestionType type);
SuggestionType getAutosuggestion();
// JDK specific modification
default void zeroOut() {
throw new UnsupportedOperationException();
}
}

@ -6250,4 +6250,10 @@ public class LineReaderImpl implements LineReader, Flushable
}
}
// JDK specific modification
@Override
public void zeroOut() {
buf.zeroOut();
parsedLine = null;
}
}