changeset 10150:e88d39b110dd

8025480: [parfait] "JNI exception pending" warnings from b107 for jdk.src.share.native.sun.java2d Reviewed-by: prr, jgodinez
author jchen
date Thu, 03 Oct 2013 13:26:45 -0700
parents 2f11a00279ec
children 3c1b13ad0677
files src/share/native/sun/java2d/Disposer.c src/share/native/sun/java2d/SurfaceData.c
diffstat 2 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/java2d/Disposer.c	Thu Oct 03 13:16:31 2013 -0700
+++ b/src/share/native/sun/java2d/Disposer.c	Thu Oct 03 13:26:45 2013 -0700
@@ -38,10 +38,9 @@
 {
     addRecordMID = (*env)->GetStaticMethodID(env, disposerClass, "addRecord",
                                              "(Ljava/lang/Object;JJ)V");
-    if (addRecordMID == 0) {
-        JNU_ThrowNoSuchMethodError(env, "Disposer.addRecord");
+    if (addRecordMID != 0) {
+        dispClass = (*env)->NewGlobalRef(env, disposerClass);
     }
-    dispClass = (*env)->NewGlobalRef(env, disposerClass);
 }
 
 JNIEXPORT void JNICALL
@@ -50,6 +49,10 @@
     if (dispClass == NULL) {
         /* Needed to initialize the Disposer class as it may be not yet referenced */
         jclass clazz = (*env)->FindClass(env, "sun/java2d/Disposer");
+        if ((*env)->ExceptionCheck(env)) {
+            // If there's exception pending, we'll just return.
+            return;
+        }
     }
 
     (*env)->CallStaticVoidMethod(env, dispClass, addRecordMID,
--- a/src/share/native/sun/java2d/SurfaceData.c	Thu Oct 03 13:16:31 2013 -0700
+++ b/src/share/native/sun/java2d/SurfaceData.c	Thu Oct 03 13:26:45 2013 -0700
@@ -237,7 +237,9 @@
     SurfaceData_SetOps(env, sData, ops);
     if (ops != NULL) {
         memset(ops, 0, opsSize);
-        ops->sdObject = (*env)->NewWeakGlobalRef(env, sData);
+        if (!(*env)->ExceptionCheck(env)) {
+            ops->sdObject = (*env)->NewWeakGlobalRef(env, sData);
+        }
     }
     return ops;
 }