RFR: JDK-8036607 - JNI exception pending in jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c

Mark Sheppard mark.sheppard at oracle.com
Fri Mar 7 11:46:55 UTC 2014


Hi
    Please oblige and review the following changes
http://cr.openjdk.java.net/~msheppar/8036607/webrev/

which address the issue raised in
https://bugs.openjdk.java.net/browse/JDK-8036607

Summary:
Changes to src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c
two additions to take into account pending JNI exceptions have been
added

regards
Mark

-----------------------------------------------------------------oOo-------------------------------------------------------------------------------------
diff -r 9099a251d211 
src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c
--- a/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c Wed 
Mar 05 11:53:35 2014 -0800
+++ b/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c Fri 
Mar 07 11:44:51 2014 +0000
@@ -384,15 +384,19 @@ JNIEXPORT jint JNICALL Java_java_net_Dua
          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) {



More information about the net-dev mailing list