RFR: 8211163: UNIX version of Java_java_io_Console_echo does not return a clean boolean

Xueming Shen xueming.shen at oracle.com
Wed Sep 26 17:17:33 UTC 2018


+1

On 9/26/18, 9:14 AM, Alan Bateman wrote:
> On 26/09/2018 16:58, Alan Bateman wrote:
>> On 26/09/2018 16:51, Andrew Haley wrote:
>>> Java_java_io_Console_echo looks like this:
>>>
>>> JNIEXPORT jboolean JNICALL
>>> Java_java_io_Console_echo(JNIEnv *env, jclass cls, jboolean on)
>>> {
>>>      DWORD fdwMode;
>>>      jboolean old;
>>>      ...
>>>      old = (fdwMode & ENABLE_ECHO_INPUT);
>>>      ...
>>>      return old;
>>> }
>>>
>>> It only works by accident. jboolean is an unsigned byte.
>>> ENABLE_ECHO_INPUT on the systems I know of is 0000010, so fdwMode &
>>> ENABLE_ECHO_INPUT fits into the result, but only by accident. We
>>> should do things properly and return a clean boolean.
>>>
>>> Note that the Windows version of the code is correct: I assume the
>>> UNIX version is an oversight.
>>>
>>> https://bugs.openjdk.java.net/browse/JDK-8211163
>>> http://cr.openjdk.java.net/~aph/8211163/
>>>
>>> OK?
>> Probably better to bring this to core-libs-dev as I think it's the 
>> same issue as this thread:
>> http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-July/054479.html 
>>
>>
>> I can't see a conclusion (as in change-set) but Ichiroh's second mail 
>> has the same patch as you.
>>
> Moving this to core-libs-dev as this is third time this has come up. 
> The patch looks okay to me.
>
> -Alan
>



More information about the core-libs-dev mailing list