diff --git a/zenoh-jni/Cargo.toml b/zenoh-jni/Cargo.toml index 42859c1db..71f74457a 100644 --- a/zenoh-jni/Cargo.toml +++ b/zenoh-jni/Cargo.toml @@ -38,7 +38,6 @@ json5 = "0.4.1" serde_yaml = "0.9.19" zenoh = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false } zenoh-ext = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false } -zenoh-protocol = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false } tracing = "0.1" [lib] name = "zenoh_jni" diff --git a/zenoh-jni/src/scouting.rs b/zenoh-jni/src/scouting.rs index 2557dd290..bf8e0874f 100644 --- a/zenoh-jni/src/scouting.rs +++ b/zenoh-jni/src/scouting.rs @@ -21,7 +21,6 @@ use jni::{ }; use zenoh::{config::WhatAmIMatcher, prelude::Wait}; use zenoh::{scouting::Scout, Config}; -use zenoh_protocol::core::ZenohIdProto; use crate::{errors::Result, throw_exception}; use crate::{ @@ -66,9 +65,8 @@ pub unsafe extern "C" fn Java_io_zenoh_jni_JNIScout_00024Companion_scoutViaJNI( let _ = || -> jni::errors::Result<()> { let mut env = java_vm.attach_current_thread_as_daemon()?; let whatami = hello.whatami() as jint; - let zenoh_id_proto: ZenohIdProto = hello.zid().into(); let zenoh_id = env - .byte_array_from_slice(&zenoh_id_proto.to_le_bytes()) + .byte_array_from_slice(&hello.zid().to_le_bytes()) .map(|it| env.auto_local(it))?; let locators = env .new_object("java/util/ArrayList", "()V", &[]) diff --git a/zenoh-jni/src/session.rs b/zenoh-jni/src/session.rs index 0c235e397..9eaea3d79 100644 --- a/zenoh-jni/src/session.rs +++ b/zenoh-jni/src/session.rs @@ -32,7 +32,6 @@ use zenoh::pubsub::{Publisher, Subscriber}; use zenoh::query::{Query, Queryable, ReplyError, Selector}; use zenoh::sample::Sample; use zenoh::session::{Session, SessionDeclarations}; -use zenoh_protocol::core::ZenohIdProto; /// Open a Zenoh session via JNI. /// @@ -918,8 +917,7 @@ fn on_reply_success( .map_or_else( || Ok(JByteArray::default()), |replier_id| { - let zenoh_id_proto: ZenohIdProto = replier_id.into(); - env.byte_array_from_slice(&zenoh_id_proto.to_le_bytes()) + env.byte_array_from_slice(&replier_id.to_le_bytes()) .map_err(|err| jni_error!(err)) }, ) @@ -1005,8 +1003,7 @@ fn on_reply_error( .map_or_else( || Ok(JByteArray::default()), |replier_id| { - let zenoh_id_proto: ZenohIdProto = replier_id.into(); - env.byte_array_from_slice(&zenoh_id_proto.to_le_bytes()) + env.byte_array_from_slice(&replier_id.to_le_bytes()) .map_err(|err| jni_error!(err)) }, ) diff --git a/zenoh-jni/src/zenoh_id.rs b/zenoh-jni/src/zenoh_id.rs index 22641f993..9b54a1463 100644 --- a/zenoh-jni/src/zenoh_id.rs +++ b/zenoh-jni/src/zenoh_id.rs @@ -19,7 +19,6 @@ use jni::{ JNIEnv, }; use zenoh::config::ZenohId; -use zenoh_protocol::core::ZenohIdProto; /// Returns the string representation of a ZenohID. #[no_mangle] @@ -31,9 +30,7 @@ pub extern "C" fn Java_io_zenoh_jni_JNIZenohID_toStringViaJNI( ) -> jstring { || -> Result { let bytes = decode_byte_array(&env, zenoh_id)?; - let zenohIdProto = - ZenohIdProto::try_from(bytes.as_slice()).map_err(|err| session_error!(err))?; - let zenohid = ZenohId::from(zenohIdProto); + let zenohid = ZenohId::try_from(bytes.as_slice()).map_err(|err| session_error!(err))?; env.new_string(zenohid.to_string()) .map_err(|err| jni_error!(err)) }()