# HG changeset patch # User alanb # Date 1388763725 0 # Node ID e0db672f080e624be2dc7cd91b7bbfc9b030a316 # Parent 49bc688ee68b68e4a2ee1771a5d2a6dfc0e8f90b 8029018: (bf) Check src/share/native/java/nio/Bits.c for JNI pending exceptions Reviewed-by: chegar diff -r 49bc688ee68b -r e0db672f080e jdk/src/share/native/java/nio/Bits.c --- a/jdk/src/share/native/java/nio/Bits.c Fri Jan 03 06:28:56 2014 +0000 +++ b/jdk/src/share/native/java/nio/Bits.c Fri Jan 03 15:42:05 2014 +0000 @@ -51,10 +51,13 @@ #define MBYTE 1048576 -#define GETCRITICAL(bytes, env, obj) { \ +#define GETCRITICAL_OR_RETURN(bytes, env, obj) { \ bytes = (*env)->GetPrimitiveArrayCritical(env, obj, NULL); \ - if (bytes == NULL) \ - JNU_ThrowInternalError(env, "Unable to get array"); \ + if (bytes == NULL) { \ + if ((*env)->ExceptionOccurred(env) == NULL) \ + JNU_ThrowInternalError(env, "Unable to get array"); \ + return; \ + } \ } #define RELEASECRITICAL(bytes, env, obj, mode) { \ @@ -85,7 +88,7 @@ else size = (size_t)length; - GETCRITICAL(bytes, env, src); + GETCRITICAL_OR_RETURN(bytes, env, src); srcShort = (jshort *)(bytes + srcPos); endShort = srcShort + (size / sizeof(jshort)); @@ -120,7 +123,7 @@ else size = (size_t)length; - GETCRITICAL(bytes, env, dst); + GETCRITICAL_OR_RETURN(bytes, env, dst); dstShort = (jshort *)(bytes + dstPos); endShort = srcShort + (size / sizeof(jshort)); @@ -155,7 +158,7 @@ else size = (size_t)length; - GETCRITICAL(bytes, env, src); + GETCRITICAL_OR_RETURN(bytes, env, src); srcInt = (jint *)(bytes + srcPos); endInt = srcInt + (size / sizeof(jint)); @@ -190,7 +193,7 @@ else size = (size_t)length; - GETCRITICAL(bytes, env, dst); + GETCRITICAL_OR_RETURN(bytes, env, dst); dstInt = (jint *)(bytes + dstPos); endInt = srcInt + (size / sizeof(jint)); @@ -225,7 +228,7 @@ else size = (size_t)length; - GETCRITICAL(bytes, env, src); + GETCRITICAL_OR_RETURN(bytes, env, src); srcLong = (jlong *)(bytes + srcPos); endLong = srcLong + (size / sizeof(jlong)); @@ -260,7 +263,7 @@ else size = (size_t)length; - GETCRITICAL(bytes, env, dst); + GETCRITICAL_OR_RETURN(bytes, env, dst); dstLong = (jlong *)(bytes + dstPos); endLong = srcLong + (size / sizeof(jlong));