8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c
authorprr
Tue, 19 Aug 2014 14:38:25 -0700
changeset 26354 2d04e6c7ed68
parent 26353 b5e3b7fbf56d
child 26355 cc3d1aa1ca6b
8055201: JNI exception pending in jdk/src/solaris/native/sun/awt/CUPSfuncs.c Reviewed-by: bae, serb
jdk/src/java.desktop/unix/native/common/sun/awt/CUPSfuncs.c
--- a/jdk/src/java.desktop/unix/native/common/sun/awt/CUPSfuncs.c	Tue Aug 19 11:03:55 2014 -0700
+++ b/jdk/src/java.desktop/unix/native/common/sun/awt/CUPSfuncs.c	Tue Aug 19 14:38:25 2014 -0700
@@ -436,6 +436,7 @@
     if (name == NULL) {
         (*env)->ExceptionClear(env);
         JNU_ThrowOutOfMemoryError(env, "Could not create printer name");
+        return;
     }
     const char *filename;
 
@@ -467,8 +468,11 @@
             }
         }
         if (defx > 0) {
-          jobject rxObj = (*env)->NewObject(env, intCls, intCtr, defx);
-          jobject ryObj = (*env)->NewObject(env, intCls, intCtr, defy);
+          jobject rxObj, ryObj;
+          rxObj = (*env)->NewObject(env, intCls, intCtr, defx);
+          CHECK_NULL(rxObj);
+          ryObj = (*env)->NewObject(env, intCls, intCtr, defy);
+          CHECK_NULL(ryObj);
           (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj);
           (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj);
         }
@@ -492,8 +496,11 @@
                 }
             }
             if (resx > 0 && (resx != defx || resy != defy )) {
-              jobject rxObj = (*env)->NewObject(env, intCls, intCtr, resx);
-              jobject ryObj = (*env)->NewObject(env, intCls, intCtr, resy);
+              jobject rxObj, ryObj;
+              rxObj = (*env)->NewObject(env, intCls, intCtr, resx);
+              CHECK_NULL(rxObj);
+              ryObj = (*env)->NewObject(env, intCls, intCtr, resy);
+              CHECK_NULL(ryObj);
               (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj);
               (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj);
             }