# HG changeset patch # User msheppar # Date 1395360820 0 # Node ID 62146f638e22fd26beff07c9590c9679b2d3adf5 # Parent 71ed058849d42753cffe51c31a24bfd28bda6d72 8036607: JNI exception pending in jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c Summary: check for JNI pending exception and NULL returns from JNI calls in DualStackPlainDatagramSocketImpl.c Reviewed-by: alanb diff -r 71ed058849d4 -r 62146f638e22 jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c --- a/jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c Fri Mar 21 00:01:59 2014 +0000 +++ b/jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c Fri Mar 21 00:13:40 2014 +0000 @@ -384,15 +384,19 @@ if (packetAddress == NULL) { packetAddress = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, &port); - /* stuff the new Inetaddress into the packet */ - (*env)->SetObjectField(env, dpObj, dp_addressID, packetAddress); + if (packetAddress != NULL) { + /* stuff the new Inetaddress into the packet */ + (*env)->SetObjectField(env, dpObj, dp_addressID, packetAddress); + } } - /* populate the packet */ - (*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, rv, + if (!(*env)->ExceptionCheck(env)) { + /* populate the packet */ + (*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, rv, (jbyte *)fullPacket); - (*env)->SetIntField(env, dpObj, dp_portID, port); - (*env)->SetIntField(env, dpObj, dp_lengthID, rv); + (*env)->SetIntField(env, dpObj, dp_portID, port); + (*env)->SetIntField(env, dpObj, dp_lengthID, rv); + } } if (packetBufferLen > MAX_BUFFER_LEN) {