diff --git a/src/windows/native/sun/windows/awt_Component.cpp b/src/windows/native/sun/windows/awt_Component.cpp index d8148f9d0d90a06ba15e1a3c5498ca17aa664818..5bd7bf4e5f4427b0d6a336f8b3c4f4b2d08b57ae 100644 --- a/src/windows/native/sun/windows/awt_Component.cpp +++ b/src/windows/native/sun/windows/awt_Component.cpp @@ -467,7 +467,9 @@ void AwtComponent::InitPeerGraphicsConfig(JNIEnv *env, jobject peer) jclass win32GCCls = env->FindClass("sun/awt/Win32GraphicsConfig"); DASSERT(win32GCCls != NULL); DASSERT(env->IsInstanceOf(compGC, win32GCCls)); - CHECK_NULL(win32GCCls); + if (win32GCCls == NULL) { + throw std::bad_alloc(); + } env->SetObjectField(peer, AwtComponent::peerGCID, compGC); } } diff --git a/src/windows/native/sun/windows/awt_Cursor.cpp b/src/windows/native/sun/windows/awt_Cursor.cpp index 6c102669173e85acf4cb23116fb8ad07b98a87a6..3cdf9d8d64259f5660d6359118bab01e72b318f5 100644 --- a/src/windows/native/sun/windows/awt_Cursor.cpp +++ b/src/windows/native/sun/windows/awt_Cursor.cpp @@ -229,9 +229,10 @@ void AwtCursor::UpdateCursor(AwtComponent *comp) { if (cur != NULL) { ::SetCursor(cur); } else { - safe_ExceptionOccurred(env); + if (safe_ExceptionOccurred(env)) { + env->ExceptionClear(); + } } - if (AwtCursor::updateCursorID == NULL) { jclass cls = env->FindClass("sun/awt/windows/WGlobalCursorManager"); diff --git a/src/windows/native/sun/windows/awt_PrintJob.cpp b/src/windows/native/sun/windows/awt_PrintJob.cpp index b9d818e0cfd10e8f599e35bffb2f92d4d42ca5b2..7217f53ed7e8b7a0ab80c4b0ee7bf127a3f90eeb 100644 --- a/src/windows/native/sun/windows/awt_PrintJob.cpp +++ b/src/windows/native/sun/windows/awt_PrintJob.cpp @@ -758,6 +758,7 @@ Java_sun_awt_windows_WPrinterJob_getDefaultPage(JNIEnv *env, jobject self, // through print dialog or start of printing // None of those may have happened yet, so call initPrinter() initPrinter(env, self); + JNU_CHECK_EXCEPTION(env); HANDLE hDevNames = AwtPrintControl::getPrintHDName(env, self); HDC hdc = AwtPrintControl::getPrintDC(env, self); @@ -1102,6 +1103,7 @@ Java_sun_awt_windows_WPrinterJob_initPrinter(JNIEnv *env, jobject self) { jboolean err; initPrinter(env, self); + JNU_CHECK_EXCEPTION(env); // check for collation HGLOBAL hDevNames = AwtPrintControl::getPrintHDName(env, self); @@ -1362,6 +1364,13 @@ Java_sun_awt_windows_WPrinterJob__1startDoc(JNIEnv *env, jobject self, } initPrinter(env, self); + if (env->ExceptionCheck()) { + if (dest != NULL) { + JNU_ReleaseStringPlatformChars(env, dest, destination); + } + return JNI_FALSE; + } + HDC printDC = AwtPrintControl::getPrintDC(env, self); SAVE_CONTROLWORD @@ -3827,6 +3836,7 @@ void setCapabilities(JNIEnv *env, jobject self, HDC printDC) { // pixels per inch in y direction jint yRes = GetDeviceCaps(printDC, LOGPIXELSY); err = setIntField(env, self, YRES_STR, yRes); + if (err) return; // x coord of printable area in pixels jint xOrg = GetDeviceCaps(printDC, PHYSICALOFFSETX);