JDK 8 RFR 8010371: getaddrinfo can fail with EAI_SYSTEM/EAGAIN, causes UnknownHostException to be thrown

Alan Bateman Alan.Bateman at oracle.com
Tue Oct 15 15:34:03 UTC 2013


On 15/10/2013 16:28, Brian Burkhalter wrote:
>
> The hostname is guaranteed to be in the exception detail:
>
> void
> NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
>                    const char *defaultDetail) {
>     char errmsg[255];
>     sprintf(errmsg, "errno: %d, error: %s\n", WSAGetLastError(), 
> defaultDetail);
>     JNU_ThrowByNameWithLastError(env, name, errmsg);
> }
>
> The "hostname" string is passed to the third parameter in the above 
> method.
>
For JNU_ThrowByNameWithLastError then the third parameter is the 
default/fallback, only used when the error cannot be translated. As I 
said, it's not a big deal as you are only using it for the WSATRY_AGAIN 
case.

-Alan.




More information about the core-libs-dev mailing list