mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 12:34:32 +02:00
7181353: Update error message to distinguish native OOM and java OOM in net
Reviewed-by: chegar
This commit is contained in:
parent
b28493b31b
commit
e83a16fa42
8 changed files with 16 additions and 16 deletions
|
@ -196,7 +196,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||||
struct addrinfo *next
|
struct addrinfo *next
|
||||||
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
||||||
if (!next) {
|
if (!next) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
goto cleanupAndReturn;
|
goto cleanupAndReturn;
|
||||||
}
|
}
|
||||||
|
@ -465,7 +465,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||||
struct addrinfo *next
|
struct addrinfo *next
|
||||||
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
||||||
if (!next) {
|
if (!next) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
goto cleanupAndReturn;
|
goto cleanupAndReturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,7 +267,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||||
struct addrinfo *next
|
struct addrinfo *next
|
||||||
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
||||||
if (!next) {
|
if (!next) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
goto cleanupAndReturn;
|
goto cleanupAndReturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -804,7 +804,7 @@ static netif *enumInterfaces(JNIEnv *env) {
|
||||||
do{ \
|
do{ \
|
||||||
_pointer = (_type)malloc( _size ); \
|
_pointer = (_type)malloc( _size ); \
|
||||||
if (_pointer == NULL) { \
|
if (_pointer == NULL) { \
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed"); \
|
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed"); \
|
||||||
return ifs; /* return untouched list */ \
|
return ifs; /* return untouched list */ \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
|
@ -485,7 +485,7 @@ Java_java_net_PlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
||||||
fullPacket = (char *)malloc(packetBufferLen);
|
fullPacket = (char *)malloc(packetBufferLen);
|
||||||
|
|
||||||
if (!fullPacket) {
|
if (!fullPacket) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Send buffer native heap allocation failed");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
mallocedPacket = JNI_TRUE;
|
mallocedPacket = JNI_TRUE;
|
||||||
|
@ -714,7 +714,7 @@ Java_java_net_PlainDatagramSocketImpl_peekData(JNIEnv *env, jobject this,
|
||||||
fullPacket = (char *)malloc(packetBufferLen);
|
fullPacket = (char *)malloc(packetBufferLen);
|
||||||
|
|
||||||
if (!fullPacket) {
|
if (!fullPacket) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Peek buffer native heap allocation failed");
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
mallocedPacket = JNI_TRUE;
|
mallocedPacket = JNI_TRUE;
|
||||||
|
@ -874,7 +874,7 @@ Java_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject this,
|
||||||
fullPacket = (char *)malloc(packetBufferLen);
|
fullPacket = (char *)malloc(packetBufferLen);
|
||||||
|
|
||||||
if (!fullPacket) {
|
if (!fullPacket) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Receive buffer native heap allocation failed");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
mallocedPacket = JNI_TRUE;
|
mallocedPacket = JNI_TRUE;
|
||||||
|
|
|
@ -265,7 +265,7 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketRece
|
||||||
}
|
}
|
||||||
fullPacket = (char *)malloc(packetBufferLen);
|
fullPacket = (char *)malloc(packetBufferLen);
|
||||||
if (!fullPacket) {
|
if (!fullPacket) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -427,7 +427,7 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketSend
|
||||||
}
|
}
|
||||||
fullPacket = (char *)malloc(length);
|
fullPacket = (char *)malloc(length);
|
||||||
if (!fullPacket) {
|
if (!fullPacket) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -197,7 +197,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||||
struct addrinfo *next
|
struct addrinfo *next
|
||||||
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
||||||
if (!next) {
|
if (!next) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
goto cleanupAndReturn;
|
goto cleanupAndReturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (curr == NULL) {
|
if (curr == NULL) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
|
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
|
||||||
free_netif(netifP);
|
free_netif(netifP);
|
||||||
free(tableP);
|
free(tableP);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -370,7 +370,7 @@ int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP)
|
||||||
|
|
||||||
netaddr *curr = (netaddr *)malloc(sizeof(netaddr));
|
netaddr *curr = (netaddr *)malloc(sizeof(netaddr));
|
||||||
if (curr == NULL) {
|
if (curr == NULL) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failure");
|
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
|
||||||
free_netaddr(netaddrP);
|
free_netaddr(netaddrP);
|
||||||
free(tableP);
|
free(tableP);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -243,7 +243,7 @@ jboolean exceedSizeLimit(JNIEnv *env, jint fd, jint addr, jint size)
|
||||||
addrList = curr;
|
addrList = curr;
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&sizeCheckLock);
|
LeaveCriticalSection(&sizeCheckLock);
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
curr->addr = htonl((*addrp)->S_un.S_addr);
|
curr->addr = htonl((*addrp)->S_un.S_addr);
|
||||||
|
@ -740,7 +740,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
||||||
*/
|
*/
|
||||||
fullPacket = (char *)malloc(packetBufferLen);
|
fullPacket = (char *)malloc(packetBufferLen);
|
||||||
if (!fullPacket) {
|
if (!fullPacket) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Send buf native heap allocation failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1003,7 +1003,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_peekData(JNIEnv *env, jobject thi
|
||||||
*/
|
*/
|
||||||
fullPacket = (char *)malloc(packetBufferLen);
|
fullPacket = (char *)malloc(packetBufferLen);
|
||||||
if (!fullPacket) {
|
if (!fullPacket) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1287,7 +1287,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_receive0(JNIEnv *env, jobject thi
|
||||||
*/
|
*/
|
||||||
fullPacket = (char *)malloc(packetBufferLen);
|
fullPacket = (char *)malloc(packetBufferLen);
|
||||||
if (!fullPacket) {
|
if (!fullPacket) {
|
||||||
JNU_ThrowOutOfMemoryError(env, "heap allocation failed");
|
JNU_ThrowOutOfMemoryError(env, "Receive buf native heap allocation failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue