8036793: [parfait] JNI exception pending in jdk/src/windows/native/sun/windows/awt_new.cpp
Reviewed-by: anthony, serb, azvegint
--- a/jdk/src/windows/native/sun/windows/awt_new.cpp Fri Mar 14 19:27:40 2014 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_new.cpp Mon Mar 17 13:03:39 2014 +0400
@@ -163,18 +163,13 @@
safe_ExceptionOccurred(JNIEnv *env) throw (std::bad_alloc) {
jthrowable xcp = env->ExceptionOccurred();
if (xcp != NULL) {
- env->ExceptionClear(); // if we don't do this, FindClass will fail
-
- jclass outofmem = env->FindClass("java/lang/OutOfMemoryError");
- DASSERT(outofmem != NULL);
- jboolean isOutofmem = env->IsInstanceOf(xcp, outofmem);
-
- env->DeleteLocalRef(outofmem);
-
- if (isOutofmem) {
+ env->ExceptionClear(); // if we don't do this, isInstanceOf will fail
+ jint isOutofmem = JNU_IsInstanceOfByName(env, xcp, "java/lang/OutOfMemoryError");
+ if (isOutofmem > 0) {
env->DeleteLocalRef(xcp);
throw std::bad_alloc();
} else {
+ env->ExceptionClear();
// rethrow exception
env->Throw(xcp);
return xcp;