(env: &mut JNIEnv, s: &JString, name: &str)
| 72 | } |
| 73 | |
| 74 | fn jstring_to_string(env: &mut JNIEnv, s: &JString, name: &str) -> Option<String> { |
| 75 | match env.get_string(s) { |
| 76 | Ok(js) => Some(js.into()), |
| 77 | Err(e) => { |
| 78 | throw_illegal_argument(env, &format!("failed to read {name}: {e}")); |
| 79 | None |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | fn throw_illegal_argument(env: &mut JNIEnv, message: &str) { |
| 85 | if let Err(e) = env.throw_new("java/lang/IllegalArgumentException", message) { |
no test coverage detected