RFR: JDK-8317603: provide handleSocketErrorWithMessage in windows Net.c for extended exception messages

Daniel Jeliński djelinski at openjdk.org
Thu Oct 5 16:16:28 UTC 2023


On Thu, 5 Oct 2023 14:33:14 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> On Windows, we miss a handleSocketErrorWithMessage function that provides an additional message showing what went wrong in the Net.c coding.  On Unix we have this function. 
> This leads sometimes to exceptions like
> 
> MSG RTE: javax.naming.CommunicationException: example.com:1234 [Root exception is java.net.ConnectException: Connection timed out: no further information]
> 
> see https://bugs.openjdk.org/browse/JDK-8317307
> 
> It would be better to have a message explaining the reason instead of "no further information" .

src/java.base/windows/native/libnio/ch/Net.c line 1:

> 1: /*

Thanks for this, the "no further information" message wasn't pretty.
I'm not a fan of mixing styles, and this file uses `NET_ThrowNew` a lot. Can we choose either `NET_ThrowNew` or `handleSocketErrorMessage` and use in consistently everywhere?
Also, the `NET_ThrowNew` messages usually list the function name only, without the `failed` suffix. Can we strip that suffix here?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16057#discussion_r1347674947


More information about the nio-dev mailing list