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

Brian Burkhalter brian.burkhalter at oracle.com
Tue Oct 15 15:28:57 UTC 2013


On Oct 15, 2013, at 6:21 AM, Alan Bateman wrote:

>> Here's the patch updated for this option:
>> 
>> http://cr.openjdk.java.net/~bpb/8010371/webrev.4/<http://cr.openjdk.java.net/%7Ebpb/8010371/webrev.4/>
>> 
> I think this is okay, the only concern is that the host name is no longer guaranteed to be in the exception detail (but for WSATRY_AGAIN then it might not matter because the problem is unlikely to be specific to the host name that is being looked up).

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.

Brian


More information about the core-libs-dev mailing list