(jni_env: *mut JNIEnv, this: jobject)
| 322 | } |
| 323 | |
| 324 | unsafe fn get_stack_trace_depth(jni_env: *mut JNIEnv, this: jobject) -> Result<jint, String> { |
| 325 | static mut STACK_DEPTH_METH: jmethodID = 0 as jmethodID; |
| 326 | static ONCE: Once = ONCE_INIT; |
| 327 | ONCE.call_once(|| { |
| 328 | let throwable_class = get_throwable_class(jni_env).unwrap_or(ptr::null_mut()); |
| 329 | if !throwable_class.is_null() { |
| 330 | // We swallow exceptions in here on purpose |
| 331 | let meth_name_str = CString::new("getStackTraceDepth").unwrap(); |
| 332 | let meth_sig_str = CString::new("()I").unwrap(); |
| 333 | STACK_DEPTH_METH = (**jni_env).GetMethodID.unwrap()(jni_env, |
| 334 | throwable_class, |
| 335 | meth_name_str.as_ptr(), |
| 336 | meth_sig_str.as_ptr()); |
| 337 | let _ = util::result_or_jni_ex((), jni_env); |
| 338 | } |
| 339 | }); |
| 340 | if STACK_DEPTH_METH.is_null() { return Result::Err("No getStackTraceDepth method".to_string()); } |
| 341 | return util::result_or_jni_ex((**jni_env).CallIntMethod.unwrap()(jni_env, this, STACK_DEPTH_METH), jni_env) |
| 342 | } |
| 343 | |
| 344 | #[no_mangle] |
| 345 | #[allow(non_snake_case)] |
no test coverage detected