RFR: 8259045: Exception message from saproc.dll is garbled on Windows with Japanese locale

Ioi Lam iklam at openjdk.java.net
Tue Jan 5 01:33:55 UTC 2021


On Tue, 5 Jan 2021 00:41:11 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

>> There are probably 25 or so places in our code where we use FormatMessage to get the error message. Are these all going to run into the same FormateMessage bug?
>> 
>> Also, it's not clear to me why you are getting garbled text in the first place. You said "Windows API might not return UTF-8 encoded string on Japanese locale." Why is that the case?
>
>> There are probably 25 or so places in our code where we use FormatMessage to get the error message. Are these all going to run into the same FormateMessage bug?
> 
> jdk.hotspot.agent do not have `FormatMessage()` call in other place.
> Did you say about whole JDK code? I haven't checked all of them, but some code (e.g. net_util_md.c) uses `JNU_ThrowByName()` which is provided by java.dll.
> 
>> Also, it's not clear to me why you are getting garbled text in the first place. You said "Windows API might not return UTF-8 encoded string on Japanese locale." Why is that the case?
> 
> Japanese locale on Windows uses CP932., so `FormatMessage()` would return error message with Japanese chars which are encoded by CP932. It is not UTF-8.

Now the saproc DLL has an external reference to getLastErrorString, JNU_NewStringPlatform and JNU_NewObjectByName on all platforms. Do we need to modify the makefiles for platforms other than Windows?

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

PR: https://git.openjdk.java.net/jdk/pull/1928


More information about the serviceability-dev mailing list