changeset 9606:9bf152a802af

8035867: [parfait] JNI exception pending in jdk/src/windows/native/sun/java2d/windows/GDIRenderer.cpp Reviewed-by: serb, pchelko
author azvegint
date Wed, 05 Mar 2014 16:01:22 +0400
parents 166f72ffcf18
children cdb25a970c76
files src/windows/native/sun/java2d/windows/GDIRenderer.cpp
diffstat 1 files changed, 43 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/sun/java2d/windows/GDIRenderer.cpp	Wed Mar 05 16:33:00 2014 +0400
+++ b/src/windows/native/sun/java2d/windows/GDIRenderer.cpp	Wed Mar 05 16:01:22 2014 +0400
@@ -23,6 +23,7 @@
  * questions.
  */
 
+#include "jni_util.h"
 #include "awt.h"
 #include "sun_java2d_windows_GDIRenderer.h"
 #include "java_awt_geom_PathIterator.h"
@@ -387,13 +388,20 @@
         return;
     }
 
-    POINT tmpPts[POLYTEMPSIZE], *pPoints;
+    POINT tmpPts[POLYTEMPSIZE], *pPoints = NULL;
+
     jint *xpoints = (jint *) env->GetPrimitiveArrayCritical(xpointsarray, NULL);
-    jint *ypoints = (jint *) env->GetPrimitiveArrayCritical(ypointsarray, NULL);
-    pPoints = TransformPoly(xpoints, ypoints, transx, transy,
-                            tmpPts, &npoints, isclosed, TRUE);
-    env->ReleasePrimitiveArrayCritical(xpointsarray, xpoints, JNI_ABORT);
-    env->ReleasePrimitiveArrayCritical(ypointsarray, ypoints, JNI_ABORT);
+
+    if (xpoints != NULL) {
+        jint *ypoints = (jint *) env->GetPrimitiveArrayCritical(ypointsarray, NULL);
+        if (ypoints != NULL) {
+            pPoints = TransformPoly(xpoints, ypoints, transx, transy,
+                                    tmpPts, &npoints, isclosed, TRUE);
+            env->ReleasePrimitiveArrayCritical(ypointsarray, ypoints, JNI_ABORT);
+        }
+        env->ReleasePrimitiveArrayCritical(xpointsarray, xpoints, JNI_ABORT);
+    }
+
     if (pPoints == NULL) {
         return;
     }
@@ -654,13 +662,19 @@
         return;
     }
 
-    POINT tmpPts[POLYTEMPSIZE], *pPoints;
+    POINT tmpPts[POLYTEMPSIZE], *pPoints = NULL;
+
     jint *xpoints = (jint *) env->GetPrimitiveArrayCritical(xpointsarray, NULL);
-    jint *ypoints = (jint *) env->GetPrimitiveArrayCritical(ypointsarray, NULL);
-    pPoints = TransformPoly(xpoints, ypoints, transx, transy,
-                            tmpPts, &npoints, FALSE, FALSE);
-    env->ReleasePrimitiveArrayCritical(xpointsarray, xpoints, JNI_ABORT);
-    env->ReleasePrimitiveArrayCritical(ypointsarray, ypoints, JNI_ABORT);
+    if (xpoints != NULL) {
+        jint *ypoints = (jint *) env->GetPrimitiveArrayCritical(ypointsarray, NULL);
+        if (ypoints != NULL) {
+            pPoints = TransformPoly(xpoints, ypoints, transx, transy,
+                                tmpPts, &npoints, FALSE, FALSE);
+            env->ReleasePrimitiveArrayCritical(ypointsarray, xpoints, JNI_ABORT);
+        }
+        env->ReleasePrimitiveArrayCritical(xpointsarray, xpoints, JNI_ABORT);
+    }
+
     if (pPoints == NULL) {
         return;
     }
@@ -720,13 +734,26 @@
     if (hdc == NULL) {
         return;
     }
+
+    jbyte *types = (jbyte *) env->GetPrimitiveArrayCritical(typesarray,
+                                                            NULL);
+    if (types == NULL) {
+        wsdo->ReleaseDC(env, wsdo, hdc);
+        return;
+    }
+
+    jfloat *coords = (jfloat *) env->GetPrimitiveArrayCritical(coordsarray,
+                                                               NULL);
+    if (coords == NULL) {
+        env->ReleasePrimitiveArrayCritical(typesarray, types, JNI_ABORT);
+        wsdo->ReleaseDC(env, wsdo, hdc);
+        return;
+    }
+
     ::SetPolyFillMode(hdc, (rule == java_awt_geom_PathIterator_WIND_NON_ZERO
                             ? WINDING : ALTERNATE));
     ::BeginPath(hdc);
-    jbyte *types = (jbyte *) env->GetPrimitiveArrayCritical(typesarray,
-                                                            NULL);
-    jfloat *coords = (jfloat *) env->GetPrimitiveArrayCritical(coordsarray,
-                                                               NULL);
+
     int index = 0;
     BOOL ok = TRUE;
     BOOL isempty = TRUE;