8223813: (aio) Iocp.getErrorMessage should drop trailing \r\n

Brian Burkhalter brian.burkhalter at oracle.com
Wed Jun 12 16:51:19 UTC 2019


Hi Ivan,

I am perhaps beating a dead horse here, but how about this instead?

                if (n > 0) {
                    NET_ThrowNew(env, err, buf);
                    LocalFree(buf);
                } else {
                    NET_ThrowNew(env, err, "FormatMessage failed");
                }

After all, an error *did* occur.

Thanks,

Brian

> On Jun 11, 2019, at 7:11 PM, Ivan Gerasimov <ivan.gerasimov at oracle.com> wrote:
> 
> The webrev looks fine to me.
> 
> I think that *most likely* the check if (buf != NULL) will work as expected:  buf will only be set to non-NULL value upon success.
> 
> However, the documentation for the function FormatMessage states:
> """
> If the function fails, the return value is zero.
> """
> 
> So, my preference would be if (n > 0).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190612/3fc5abee/attachment.html>


More information about the nio-dev mailing list