https://bugs.openjdk.java.net/browse/JDK-8223813 
<https://bugs.openjdk.java.net/browse/JDK-8223813>
http://cr.openjdk.java.net/~bpb/8223813/webrev.00/ 
<http://cr.openjdk.java.net/~bpb/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

Reply via email to