rust: `jni 0.19`

This commit is contained in:
Jack Grigg 2022-10-14 20:37:21 +13:00
parent 9bf667926f
commit 4d7d0bf64b
3 changed files with 9 additions and 23 deletions

15
sdk-lib/Cargo.lock generated
View File

@ -595,15 +595,6 @@ dependencies = [
"byteorder",
]
[[package]]
name = "error-chain"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc"
dependencies = [
"version_check",
]
[[package]]
name = "f4jumble"
version = "0.1.0"
@ -855,15 +846,15 @@ checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
[[package]]
name = "jni"
version = "0.17.0"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36bcc950632e48b86da402c5c077590583da5ac0d480103611d5374e7c967a3c"
checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec"
dependencies = [
"cesu8",
"combine",
"error-chain",
"jni-sys",
"log",
"thiserror",
"walkdir",
]

View File

@ -15,7 +15,7 @@ failure = "0.1"
hdwallet = "0.3.1"
hdwallet-bitcoin = "0.3"
hex = "0.4"
jni = { version = "0.17", default-features = false }
jni = { version = "0.19", default-features = false }
log = "0.4"
log-panics = "2.0.0"
schemer = "0.2"

View File

@ -56,18 +56,12 @@ fn throw(env: &JNIEnv, description: &str) {
let exception = match env.find_class("java/lang/RuntimeException") {
Ok(val) => val,
Err(e) => {
error!(
"Unable to find 'RuntimeException' class: {}",
e.description()
);
error!("Unable to find 'RuntimeException' class: {}", e.to_string());
return;
}
};
if let Err(e) = env.throw_new(exception, description) {
error!(
"Unable to find 'RuntimeException' class: {}",
e.description()
);
error!("Unable to find 'RuntimeException' class: {}", e.to_string());
}
}
@ -88,6 +82,7 @@ pub fn any_to_string(any: &Box<dyn Any + Send>) -> String {
mod tests {
use super::*;
use std::error::Error;
use std::fmt;
use std::panic;
#[test]
@ -118,7 +113,7 @@ mod tests {
assert_eq!("Unknown error occurred", any_to_string(&error));
}
fn panic_error<T: Send + 'static>(val: T) -> Box<dyn Any + Send> {
panic::catch_unwind(panic::AssertUnwindSafe(|| panic!(val))).unwrap_err()
fn panic_error<T: fmt::Display + Send + 'static>(val: T) -> Box<dyn Any + Send> {
panic::catch_unwind(panic::AssertUnwindSafe(|| panic!("{}", val))).unwrap_err()
}
}