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
--- 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) {