On Mon, 2 Dec 2024 13:53:00 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

> Can I please get a review of this minor enhancement to the error text that is 
> reported if the `getaddrinfo()` native call returns the `EAI_SYSTEM` error? 
> This addresses https://bugs.openjdk.org/browse/JDK-8227493.
> 
> The `java.net.InetAddress` class, in its implementation for resolving 
> addresses for a host name, calls the `getaddrinfo()` native call on *nix 
> platforms. If `getaddrinfo()` returns an error then we use the 
> `gai_strerror()` native call to convert the error number into an error string 
> that is then propagated to the application. Among other errors, the 
> `getaddrinfo()` is specified to return the error code `EAI_SYSTEM` which as 
> per its documentation represents
> 
>> EAI_SYSTEM        system error returned in errno
> 
> So calling `gai_strerror()` merely returns a generic "System error" text. The 
> real underlying error is present in the `errno` and that has more useful 
> information. 
> 
> The commit in this PR checks the error for `EAI_SYSTEM` and if it matches 
> then it additionally gets the error text corresponding to `errno`. So the 
> error text that gets propagated will now be "System error: Illegal byte 
> sequence", assuming `EILSEQ` was the underlying `errno` for the `getaddrinfo` 
> call (my use of `EILSEQ` in this example is arbitrary and it's merely to show 
> what the error text will look like after this change).
> 
> Given the nature of this change no new test has been introduced. Existing 
> tests in tier1, tier2 and tier3 continue to pass with this change.

This pull request has been closed without being integrated.

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

PR: https://git.openjdk.org/jdk/pull/22484

Reply via email to