8203672: JNI exception pending in PlainSocketImpl.c

8203264: JNI exception pending in PlainDatagramSocketImpl.c:740
8203673: JNI exception pending in DualStackPlainDatagramSocketImpl.c:398

Reviewed-by: chegar, igerasim
This commit is contained in:
Vyom Tewari 2018-11-23 13:16:45 +05:30
parent 4663065fad
commit 19e69dc84f
3 changed files with 25 additions and 20 deletions

View file

@ -684,9 +684,10 @@ Java_java_net_PlainDatagramSocketImpl_peekData(JNIEnv *env, jobject this,
packetAddress = NULL;
}
}
if (packetAddress == NULL) {
if (!(*env)->ExceptionCheck(env)){
if (packetAddress == NULL ) {
packetAddress = NET_SockaddrToInetAddress(env, &rmtaddr, &port);
/* stuff the new Inetaddress in the packet */
/* stuff the new InetAddress in the packet */
(*env)->SetObjectField(env, packet, dp_addressID, packetAddress);
} else {
/* only get the new port number */
@ -698,6 +699,7 @@ Java_java_net_PlainDatagramSocketImpl_peekData(JNIEnv *env, jobject this,
(*env)->SetIntField(env, packet, dp_portID, port);
(*env)->SetIntField(env, packet, dp_lengthID, n);
}
}
if (mallocedPacket) {
free(fullPacket);

View file

@ -386,15 +386,14 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketRece
packetAddress = NULL;
}
}
if (packetAddress == NULL) {
if (!(*env)->ExceptionCheck(env)){
if (packetAddress == NULL ) {
packetAddress = NET_SockaddrToInetAddress(env, &sa, &port);
if (packetAddress != NULL) {
/* stuff the new Inetaddress into the packet */
/* stuff the new InetAddress into the packet */
(*env)->SetObjectField(env, dpObj, dp_addressID, packetAddress);
}
}
if (!(*env)->ExceptionCheck(env)) {
/* populate the packet */
(*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, rv,
(jbyte *)fullPacket);

View file

@ -303,6 +303,10 @@ JNIEXPORT jint JNICALL Java_java_net_PlainSocketImpl_accept0
SetHandleInformation((HANDLE)(UINT_PTR)newfd, HANDLE_FLAG_INHERIT, 0);
ia = NET_SockaddrToInetAddress(env, &sa, &port);
if (ia == NULL){
closesocket(newfd);
return -1;
}
isa = (*env)->NewObject(env, isa_class, isa_ctorID, ia, port);
if (isa == NULL) {
closesocket(newfd);