7181353: Update error message to distinguish native OOM and java OOM in net
authorzhouyx
Fri, 06 Jul 2012 10:36:19 +0800
changeset 13245 7ab3ef5b9520
parent 13244 9f2c7c24a952
child 13246 a54c4f70775c
7181353: Update error message to distinguish native OOM and java OOM in net Reviewed-by: chegar
jdk/src/solaris/native/java/net/Inet4AddressImpl.c
jdk/src/solaris/native/java/net/Inet6AddressImpl.c
jdk/src/solaris/native/java/net/NetworkInterface.c
jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c
jdk/src/windows/native/java/net/Inet6AddressImpl.c
jdk/src/windows/native/java/net/NetworkInterface.c
jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
--- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c	Thu Jul 05 15:13:45 2012 -0700
+++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c	Fri Jul 06 10:36:19 2012 +0800
@@ -196,7 +196,7 @@
                 struct addrinfo *next
                     = (struct addrinfo*) malloc(sizeof(struct addrinfo));
                 if (!next) {
-                    JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+                    JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
                     ret = NULL;
                     goto cleanupAndReturn;
                 }
@@ -465,7 +465,7 @@
                 struct addrinfo *next
                     = (struct addrinfo*) malloc(sizeof(struct addrinfo));
                 if (!next) {
-                    JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+                    JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
                     ret = NULL;
                     goto cleanupAndReturn;
                 }
--- a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c	Thu Jul 05 15:13:45 2012 -0700
+++ b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c	Fri Jul 06 10:36:19 2012 +0800
@@ -267,7 +267,7 @@
                 struct addrinfo *next
                     = (struct addrinfo*) malloc(sizeof(struct addrinfo));
                 if (!next) {
-                    JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+                    JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
                     ret = NULL;
                     goto cleanupAndReturn;
                 }
--- a/jdk/src/solaris/native/java/net/NetworkInterface.c	Thu Jul 05 15:13:45 2012 -0700
+++ b/jdk/src/solaris/native/java/net/NetworkInterface.c	Fri Jul 06 10:36:19 2012 +0800
@@ -804,7 +804,7 @@
        do{ \
         _pointer = (_type)malloc( _size ); \
         if (_pointer == NULL) { \
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failed"); \
+            JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed"); \
             return ifs; /* return untouched list */ \
         } \
        } while(0)
--- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Thu Jul 05 15:13:45 2012 -0700
+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Fri Jul 06 10:36:19 2012 +0800
@@ -485,7 +485,7 @@
         fullPacket = (char *)malloc(packetBufferLen);
 
         if (!fullPacket) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+            JNU_ThrowOutOfMemoryError(env, "Send buffer native heap allocation failed");
             return;
         } else {
             mallocedPacket = JNI_TRUE;
@@ -714,7 +714,7 @@
         fullPacket = (char *)malloc(packetBufferLen);
 
         if (!fullPacket) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+            JNU_ThrowOutOfMemoryError(env, "Peek buffer native heap allocation failed");
             return -1;
         } else {
             mallocedPacket = JNI_TRUE;
@@ -874,7 +874,7 @@
         fullPacket = (char *)malloc(packetBufferLen);
 
         if (!fullPacket) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+            JNU_ThrowOutOfMemoryError(env, "Receive buffer native heap allocation failed");
             return;
         } else {
             mallocedPacket = JNI_TRUE;
--- a/jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c	Thu Jul 05 15:13:45 2012 -0700
+++ b/jdk/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c	Fri Jul 06 10:36:19 2012 +0800
@@ -265,7 +265,7 @@
         }
         fullPacket = (char *)malloc(packetBufferLen);
         if (!fullPacket) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+            JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
             return -1;
         }
     } else {
@@ -427,7 +427,7 @@
         }
         fullPacket = (char *)malloc(length);
         if (!fullPacket) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+            JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
             return;
         }
     } else {
--- a/jdk/src/windows/native/java/net/Inet6AddressImpl.c	Thu Jul 05 15:13:45 2012 -0700
+++ b/jdk/src/windows/native/java/net/Inet6AddressImpl.c	Fri Jul 06 10:36:19 2012 +0800
@@ -197,7 +197,7 @@
                 struct addrinfo *next
                     = (struct addrinfo*) malloc(sizeof(struct addrinfo));
                 if (!next) {
-                    JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+                    JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
                     ret = NULL;
                     goto cleanupAndReturn;
                 }
--- a/jdk/src/windows/native/java/net/NetworkInterface.c	Thu Jul 05 15:13:45 2012 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface.c	Fri Jul 06 10:36:19 2012 +0800
@@ -270,7 +270,7 @@
             }
         }
         if (curr == NULL) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
+            JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
             free_netif(netifP);
             free(tableP);
             return -1;
@@ -370,7 +370,7 @@
 
             netaddr *curr = (netaddr *)malloc(sizeof(netaddr));
             if (curr == NULL) {
-                JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
+                JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
                 free_netaddr(netaddrP);
                 free(tableP);
                 return -1;
--- a/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c	Thu Jul 05 15:13:45 2012 -0700
+++ b/jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c	Fri Jul 06 10:36:19 2012 +0800
@@ -243,7 +243,7 @@
                                 addrList = curr;
                             }
                             LeaveCriticalSection(&sizeCheckLock);
-                            JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+                            JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
                             return JNI_TRUE;
                         }
                         curr->addr = htonl((*addrp)->S_un.S_addr);
@@ -740,7 +740,7 @@
          */
         fullPacket = (char *)malloc(packetBufferLen);
         if (!fullPacket) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+            JNU_ThrowOutOfMemoryError(env, "Send buf native heap allocation failed");
             return;
         }
     } else {
@@ -1003,7 +1003,7 @@
          */
         fullPacket = (char *)malloc(packetBufferLen);
         if (!fullPacket) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+            JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
             return -1;
         }
     } else {
@@ -1287,7 +1287,7 @@
          */
         fullPacket = (char *)malloc(packetBufferLen);
         if (!fullPacket) {
-            JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
+            JNU_ThrowOutOfMemoryError(env, "Receive buf native heap allocation failed");
             return;
         }
     } else {