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

Goetz Lindenmaier goetz at openjdk.org
Thu Dec 21 12:06:56 UTC 2023


On Wed, 20 Dec 2023 08:07:38 GMT, Alan Bateman <alanb 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.

Yes, but this way it's assured we clean before we return.

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

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


More information about the core-libs-dev mailing list