Home | History | Annotate | Download | only in libnativehelper

Lines Matching refs:exception

111  * Returns a human-readable summary of an exception object.  The buffer will
113 * exception message.
115 static bool getExceptionSummary(C_JNIEnv* env, jthrowable exception, std::string& result) {
118 /* get the name of the exception's class */
119 scoped_local_ref<jclass> exceptionClass(env, (*env)->GetObjectClass(e, exception)); // can't fail
140 /* if the exception has a detail message, get that */
144 (jstring) (*env)->CallObjectMethod(e, exception, getMessage));
164 * Returns an exception (with stack trace) as a string.
166 static bool getStackTrace(C_JNIEnv* env, jthrowable exception, std::string& result) {
198 scoped_local_ref<jclass> exceptionClass(env, (*env)->GetObjectClass(e, exception)); // can't fail
201 (*env)->CallVoidMethod(e, exception, printStackTraceMethod, printWriter.get());
228 /* TODO: consider creating the new exception with this as "cause" */
229 scoped_local_ref<jthrowable> exception(env, (*env)->ExceptionOccurred(e));
232 if (exception.get() != NULL) {
234 getExceptionSummary(env, exception.get(), text);
235 ALOGW("Discarding pending exception (%s) to throw %s", text.c_str(), className);
241 ALOGE("Unable to find exception class %s", className);
248 /* an exception, most likely OOM, will now be pending */
275 static std::string jniGetStackTrace(C_JNIEnv* env, jthrowable exception) {
279 if (exception == NULL) {
280 exception = currentException.get();
281 if (exception == NULL) {
282 return "<no pending exception>";
291 if (!getStackTrace(env, exception, trace)) {
293 getExceptionSummary(env, exception, trace);
303 void jniLogException(C_JNIEnv* env, int priority, const char* tag, jthrowable exception) {
304 std::string trace(jniGetStackTrace(env, exception));