changeset 23564:62146f638e22

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
author msheppar
date Fri, 21 Mar 2014 00:13:40 +0000
parents 71ed058849d4
children b28f771b8cbe
files jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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) {