RFR: JDK-8317603: Improve exception messages thrown by sun.nio.ch.Net native methods (win) [v6]

Alan Bateman alanb at openjdk.org
Tue Oct 10 08:27:01 UTC 2023


On Tue, 10 Oct 2023 07:57:46 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" .
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   COPYRIGHT headers and minor adjustments

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

> 539: 
> 540:     if (n == SOCKET_ERROR) {
> 541:         NET_ThrowNew(env, WSAGetLastError(), error_message);

I this this one can be simplified to "setsockopt".  Source-specific multicast isn't widely used but if you did happen to get a failure here then the stack trace should make it very clear as it's a different join method.

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

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


More information about the nio-dev mailing list