changeset 9626:218ba3f17a70

8037910: [parfait] JNI warnings in jdk/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp Reviewed-by: serb, jgodinez
author prr
date Tue, 25 Mar 2014 14:16:53 -0700
parents 8b206653d196
children ee50ec79fa07
files src/share/native/sun/java2d/opengl/OGLSurfaceData.c src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/java2d/opengl/OGLSurfaceData.c	Tue Mar 25 12:51:28 2014 -0700
+++ b/src/share/native/sun/java2d/opengl/OGLSurfaceData.c	Tue Mar 25 14:16:53 2014 -0700
@@ -543,7 +543,9 @@
     }
 
     JNU_SetFieldByName(env, NULL, sdObject, "nativeWidth", "I", width);
-    JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height);
+    if (!((*env)->ExceptionOccurred(env))) {
+        JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height);
+    }
 
     (*env)->DeleteLocalRef(env, sdObject);
 }
--- a/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp	Tue Mar 25 12:51:28 2014 -0700
+++ b/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp	Tue Mar 25 14:16:53 2014 -0700
@@ -33,9 +33,16 @@
 #include "awt_BitmapUtil.h"
 #include "D3DRenderQueue.h"
 
+
 // REMIND: move to awt_Component.h
 extern "C" HWND AwtComponent_GetHWnd(JNIEnv *env, jlong pData);
 
+/* This looks weird. but since some AWT headers need to be included,
+ * we end up with AWT's alloc.h macro definition of ExceptionOccurred.
+ * The reasons for that re-defintion do not apply to this code, so undef it.
+ */
+#undef ExceptionOccurred
+
 /**
  * Initializes nativeWidth/Height fields of the SurfaceData object with
  * dimensions on the native surface.
@@ -55,7 +62,9 @@
     }
 
     JNU_SetFieldByName(env, NULL, sdObject, "nativeWidth", "I", width);
-    JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height);
+    if (!(env->ExceptionOccurred())) {
+        JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height);
+    }
 
     env->DeleteLocalRef(sdObject);
 }