Several potential fixes have been identified for the windows native coding of Inet4AddressImpl and Inet6AddressImpl. Besides some formatting cleanup in the source code, these are the most significant changes:
Java_java_net_Inet4AddressImpl_lookupAllHostAddr:
- remove isspace(hostname[0]) check. The comment says that it is only needed because of a bug in Windows2000. But this version is not supported by OpenJDK9. The tests show no problems with removing it.
- remove isDottedIPAddress check. This is Windows specific and tests did not reveal problems when removing it. Usually IPv4 addresses should not be handed down to this function, only invalid ones. And then getaddrinfo would be called with the handed String as name.
Java_java_net_Inet6AddressImpl_lookupAllHostAddr:
- use NET_ThrowByNameWithLastError after getaddrinfo non null return, to reflect WSAGetLastError value
Java_java_net_Inet6AddressImpl_getHostByAddr:
- replace CHECK_NULL_RETURN(ret, NULL) with UnknownHostException in case of getnameinfo error – this seems more correct when looking at the usage of getHostByAddr in InetAddress.java
Java_java_net_Inet4AddressImpl_isReachable0
Java_java_net_Inet6AddressImpl_isReachable0:
- cleanups to consistently use SOCKETADDRESS struct
Java_java_net_Inet4AddressImpl_lookupAllHostAddr:
- remove isspace(hostname[0]) check. The comment says that it is only needed because of a bug in Windows2000. But this version is not supported by OpenJDK9. The tests show no problems with removing it.
- remove isDottedIPAddress check. This is Windows specific and tests did not reveal problems when removing it. Usually IPv4 addresses should not be handed down to this function, only invalid ones. And then getaddrinfo would be called with the handed String as name.
Java_java_net_Inet6AddressImpl_lookupAllHostAddr:
- use NET_ThrowByNameWithLastError after getaddrinfo non null return, to reflect WSAGetLastError value
Java_java_net_Inet6AddressImpl_getHostByAddr:
- replace CHECK_NULL_RETURN(ret, NULL) with UnknownHostException in case of getnameinfo error – this seems more correct when looking at the usage of getHostByAddr in InetAddress.java
Java_java_net_Inet4AddressImpl_isReachable0
Java_java_net_Inet6AddressImpl_isReachable0:
- cleanups to consistently use SOCKETADDRESS struct