RFR: 8322417: Console read line with zero out should zero out when throwing exception

Alan Bateman alanb at openjdk.org
Wed Dec 20 08:10:47 UTC 2023


On Tue, 19 Dec 2023 12:47:53 GMT, Goetz Lindenmaier <goetz at openjdk.org> wrote:

> …g exception
> 
> After leaving the method by throwing an exception the data can not be cleaned any more.

src/java.base/share/classes/jdk/internal/io/JdkConsoleImpl.java line 122:

> 120:                             ioe.addSuppressed(x);
> 121:                     }
> 122:                     if (ioe != null) {

I assume it's only important to zero the buffer when restoring the echo setting fails. If I read the changes correctly then it's been zero's even if readLine fails. It's okay, just probably unnecessary for that case.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17156#discussion_r1432381996


More information about the core-libs-dev mailing list