Hi Brian,
Having the extraneous suffix consistently removed seems like a good thing.
Though I'm not sure what the best form of the utility function is:
1) return the count of characters to remove
2) just truncate the buffer.
There may be ways to force some of the errors that would lead to the
truncation, but testing all uses will not be practical.
$.02, Roger
On 06/11/2019 01:56 PM, Brian Burkhalter wrote:
https://bugs.openjdk.java.net/browse/JDK-8223813
http://cr.openjdk.java.net/~bpb/8223813/webrev.00/
<http://cr.openjdk.java.net/%7Ebpb/8223813/webrev.00/>
FormatMessage() and FormatMessageW() occur in a number of locations:
src/java.base/windows/native/libjli/java_md.c
src/java.base/windows/native/libnet/Inet4AddressImpl.c
src/java.base/windows/native/libjava/ProcessImpl_md.c
src/java.base/windows/native/libjava/jni_util_md.c
src/java.base/windows/native/libnio/ch/Iocp.c
src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c
src/java.base/share/native/libzip/zlib/gzlib.c
Some of these already strip the terminal CRLF (or dot + CRLF) of the
string populated by FormatMessage[W](). This patch would add removing
them, if present, from
src/java.base/windows/native/libnet/Inet4AddressImpl.c
src/java.base/windows/native/libnio/ch/Iocp.c
src/java.base/windows/native/libnio/fs/WindowsNativeDispatcher.c
One question is whether it would be better just to consolidate this
code into two methods for example in jni_uitl and call the methods
from the other locations. There are already getLastErrorString() and
getErrorString() for chars here.
Also, I am not sure how to test this effectively. The code passes all
tiers as-is.
Thanks,
Brian