8036793: [parfait] JNI exception pending in jdk/src/windows/native/sun/windows/awt_new.cpp

Reviewed-by: anthony, serb, azvegint
This commit is contained in:
Petr Pchelko 2014-03-17 13:03:39 +04:00
parent 9fc69a0f41
commit f80b2f863c

@ -163,18 +163,13 @@ jthrowable
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;