RFR: 8295803: Console should be usable in jshell and other environments [v11]

Naoto Sato naoto at openjdk.org
Wed Dec 7 17:09:56 UTC 2022


On Wed, 7 Dec 2022 11:54:11 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Making the wrapper classes static
>
> src/java.base/share/classes/java/io/Console.java line 625:
> 
>> 623:             };
>> 624:             return AccessController.doPrivileged(pa);
>> 625:         } catch (Throwable ignore) {
> 
> I don't think we should be catching and ignoring throwable here. The only case that would be okay to ignore here is SCE due to SecurityException as the jline provider doesn't work with a SM set.

OK, reverted the catch clause.

> src/java.base/share/classes/java/io/ProxyingConsole.java line 175:
> 
>> 173: 
>> 174:         public WrappingWriter(PrintWriter pw, Object lock) {
>> 175:             super(pw);
> 
> PrintWriter doesn't provide a way to provide to lock object so this means the overridden methods will synchronize on "lock", the non-overridden methods will synchronize on "pw". So we will need to look at this.

Created a package private constructor just for `ProxyingConsole` to synchronize on the specified lock object.

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

PR: https://git.openjdk.org/jdk/pull/11421



More information about the security-dev mailing list