From 6d5299e34a659cf650f267f957e169749bdc5c79 Mon Sep 17 00:00:00 2001 From: prr Date: Fri, 4 Apr 2014 09:56:44 -0700 Subject: [PATCH] 8037910: JNI warnings in jdk/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp Reviewed-by: serb, jgodinez --- src/share/native/sun/java2d/opengl/OGLSurfaceData.c | 2 ++ src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/share/native/sun/java2d/opengl/OGLSurfaceData.c b/src/share/native/sun/java2d/opengl/OGLSurfaceData.c index 321f9c5e6..83c0b59f3 100644 --- a/src/share/native/sun/java2d/opengl/OGLSurfaceData.c +++ b/src/share/native/sun/java2d/opengl/OGLSurfaceData.c @@ -543,7 +543,9 @@ OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo, } JNU_SetFieldByName(env, NULL, sdObject, "nativeWidth", "I", width); + if (!((*env)->ExceptionOccurred(env))) { JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height); + } (*env)->DeleteLocalRef(env, sdObject); } diff --git a/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp b/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp index c961451f5..1ede03bf5 100644 --- a/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp +++ b/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp @@ -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 @@ void D3DSD_SetNativeDimensions(JNIEnv *env, D3DSDOps *d3dsdo) { } JNU_SetFieldByName(env, NULL, sdObject, "nativeWidth", "I", width); + if (!(env->ExceptionOccurred())) { JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height); + } env->DeleteLocalRef(sdObject); } -- GitLab