From d5c467d976653ef44fdb7037776c57ff1ccfd4c2 Mon Sep 17 00:00:00 2001 From: Peter Brunet Date: Fri, 28 Mar 2014 17:19:10 -0500 Subject: [PATCH] 8034768: [parfait] JNI exception pending in jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m Handle possible JNI Exceptions Reviewed-by: prr, serb --- jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m b/jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m index 279eb9ad1ef..2809d8bcbf5 100644 --- a/jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m +++ b/jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m @@ -40,6 +40,11 @@ static JNF_STATIC_MEMBER_CACHE(sjm_getAccessibleName, sjc_CAccessibility, "getAc */ NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) { jint *values = (*env)->GetIntArrayElements(env, array, 0); + if (values == NULL) { + // Note: Java will not be on the stack here so a java exception can't happen and no need to call ExceptionCheck. + NSLog(@"%s failed calling GetIntArrayElements", __FUNCTION__); + return nil; + }; NSValue *value = [NSValue valueWithRange:NSMakeRange(values[0], values[1] - values[0])]; (*env)->ReleaseIntArrayElements(env, array, values, 0); return value; @@ -285,6 +290,11 @@ NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) { // We cheat because we know that the array is 4 elements long (x, y, width, height) jdouble *values = (*env)->GetDoubleArrayElements(env, axBounds, 0); + if (values == NULL) { + // Note: Java will not be on the stack here so a java exception can't happen and no need to call ExceptionCheck. + NSLog(@"%s failed calling GetDoubleArrayElements", __FUNCTION__); + return nil; + }; NSRect bounds; bounds.origin.x = values[0]; bounds.origin.y = [[[[self view] window] screen] frame].size.height - values[1] - values[3]; //values[1] is y-coord from top-left of screen. Flip. Account for the height (values[3]) when flipping