diff options
| author | Elliott Hughes <enh@google.com> | 2009-10-07 16:33:23 -0700 |
|---|---|---|
| committer | Elliott Hughes <enh@google.com> | 2009-10-07 16:33:23 -0700 |
| commit | 685130aef232bb87a69369093c603f256db4d32c (patch) | |
| tree | feae64d0ec8aa601acd5c140fdf5b17c878724dc /libcore/xml | |
| parent | 3ca00f6c654aa2d4dd4c041dd8bf8ba1002a324d (diff) | |
| download | android_dalvik-685130aef232bb87a69369093c603f256db4d32c.tar.gz android_dalvik-685130aef232bb87a69369093c603f256db4d32c.tar.bz2 android_dalvik-685130aef232bb87a69369093c603f256db4d32c.zip | |
JNI Delete* and Release* _are_ allowed while an exception is pending.
See "Exceptions" in our own documentation:
http://android.git.kernel.org/?p=platform/dalvik.git;a=blob_plain;f=docs/jni-tips.html;hb=HEAD
This is also true of the RI, though the spec sometimes implies otherwise.
Here's the canonical reference:
http://java.sun.com/docs/books/jni/html/design.html#2193
Diffstat (limited to 'libcore/xml')
| -rw-r--r-- | libcore/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/libcore/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/libcore/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp index 15f1d28d7..9192b1af6 100644 --- a/libcore/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp +++ b/libcore/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp @@ -790,18 +790,7 @@ static void processingInstruction(void* data, const char* target, env->CallVoidMethod(javaParser, processingInstructionMethod, javaTarget, javaInstructionData); - // We have to temporarily clear an exception before we can release local - // references. - jthrowable exception = env->ExceptionOccurred(); - if (exception != NULL) { - env->ExceptionClear(); - } - env->DeleteLocalRef(javaInstructionData); - - if (exception != NULL) { - env->Throw(exception); - } } /** @@ -998,16 +987,7 @@ static void appendString(JNIEnv* env, jobject object, jint pointer, jstring xml, jniThrowExpatException(env, XML_GetErrorCode(parser)); } - // We have to temporarily clear an exception before we can release local - // references. - jthrowable exception = env->ExceptionOccurred(); - if (exception) { - env->ExceptionClear(); - env->ReleaseStringChars(xml, characters); - env->Throw(exception); - } else { - env->ReleaseStringChars(xml, characters); - } + env->ReleaseStringChars(xml, characters); context->object = NULL; context->env = NULL; @@ -1036,16 +1016,7 @@ static void appendCharacters(JNIEnv* env, jobject object, jint pointer, jniThrowExpatException(env, XML_GetErrorCode(parser)); } - // We have to temporarily clear an exception before we can release local - // references. - jthrowable exception = env->ExceptionOccurred(); - if (exception) { - env->ExceptionClear(); - env->ReleaseCharArrayElements(xml, characters, JNI_ABORT); - env->Throw(exception); - } else { - env->ReleaseCharArrayElements(xml, characters, JNI_ABORT); - } + env->ReleaseCharArrayElements(xml, characters, JNI_ABORT); context->object = NULL; context->env = NULL; @@ -1074,16 +1045,7 @@ static void appendBytes(JNIEnv* env, jobject object, jint pointer, jniThrowExpatException(env, XML_GetErrorCode(parser)); } - // We have to temporarily clear an exception before we can release local - // references. - jthrowable exception = env->ExceptionOccurred(); - if (exception) { - env->ExceptionClear(); - env->ReleaseByteArrayElements(xml, bytes, JNI_ABORT); - env->Throw(exception); - } else { - env->ReleaseByteArrayElements(xml, bytes, JNI_ABORT); - } + env->ReleaseByteArrayElements(xml, bytes, JNI_ABORT); context->object = NULL; context->env = NULL; |
