The zenoh-jni-runtime in the common-jni branch (use it as destination) throws exceptions from the Rust code.
This is inconvenient for zenoh-kotlin library (in the different repo) which reuses zenoh-jni-runtime and have to wrap each jni call to runCatching.
The new JNI API functions will follow this pattern:
their return value should include error variant:
negative value for enum ints
null for objects/strings
integer with negative value instead of bool
etc...
they accept string parameter error. In case of error they return error variant value and set error string to error message. In case of success error stays intact
No exception throwing from zenoh-jni-runtime anymore.
No export of error type from zenoh-jni-runtime.
Error type export and throwing exception is performed on zenoh-java level
---PARAMETERS---
stack: [{"pipeline":"plan","calling_stage":"call_work"},{"pipeline":"plan","calling_stage":"working"}]
work_branch: zbobr_fix-75-throw-execptions-from-java
destination_branch: common-jni
pr_url: milyin-zenoh-zbobr/zenoh-java#6
state: pause
stage_count: 40
max_stage_count: 40
---STATUS---
❌ 2026-04-21 17:40:15 +0200 Stage count limit (40) reached - auto-paused
---DEAD_CONTEXT---
zenoh-java:plan:configuring copilot gpt-5-mini 2026-04-20 18:17:40 +0200 prompt output
✅ destination branch set to common-jni ctx_rec_1
zenoh-java:plan:configuring copilot gpt-5-mini 2026-04-20 22:02:59 +0200 prompt output
✅ no destination branch override needed ctx_rec_2
zenoh-java:plan:planning claude_planner claude-sonnet-4-6 2026-04-20 22:05:39 +0200 prompt output
✅ Implementation plan designed for refactoring zenoh-java JNI error handling: repl ctx_rec_3
zenoh-java:plan:plan_review_adversarial copilot gpt-5.4 2026-04-20 22:18:31 +0200 prompt output
❌ Plan is not ready: it leaves JNI/runtime exception paths and required call sites ctx_rec_4
zenoh-java:plan:planning claude_planner claude-sonnet-4-6 2026-04-20 22:23:43 +0200 prompt output
✅ Revised implementation plan covering all throw_exception! paths: adds zbytes/zby ctx_rec_5
zenoh-java:plan:plan_review_adversarial copilot gpt-5.4 2026-04-20 22:31:56 +0200 prompt output
❌ Revised plan is close, but it is still not implementation-ready: it omits the ze ctx_rec_6
zenoh-java:plan:planning claude_planner claude-sonnet-4-6 2026-04-20 22:38:09 +0200 prompt output
✅ Revised implementation plan addressing all ctx_rec_6 blocking issues: added Live ctx_rec_7
zenoh-java:plan:plan_review_adversarial copilot gpt-5.4 2026-04-20 22:46:05 +0200 prompt output
✅ Plan is now sound and implementation-ready. The liveliness blocker is fixed, the ctx_rec_8
zenoh-java:work:working claude claude-sonnet-4-6 2026-04-20 23:21:19 +0200 prompt output
zenoh-java:work:working copilot claude-sonnet-4.6 2026-04-20 23:30:19 +0200 prompt output
✅ All JNI error handling refactored: exceptions now thrown from Kotlin, not Rust ctx_rec_28
zenoh-java:work:reviewing copilot gpt-5.4 2026-04-20 23:59:53 +0200 prompt output
❌ Review failed: ZenohId JNI path was left half-migrated, and ZBytes runtime tests ctx_rec_29
zenoh-java:work:working claude claude-sonnet-4-6 2026-04-21 00:05:02 +0200 prompt output
zenoh-java:work:working copilot claude-sonnet-4.6 2026-04-21 00:05:13 +0200 prompt output
✅ Fixed ZenohId JNI migration and ZBytes test compilation. All tests pass. ctx_rec_30
zenoh-java:work:reviewing copilot gpt-5.4 2026-04-21 00:12:32 +0200 prompt output
❌ Review failed: zbytes runtime adapters still use Any? instead of ByteArray?, and ctx_rec_31
zenoh-java:work:working claude claude-sonnet-4-6 2026-04-21 00:17:39 +0200 prompt output
zenoh-java:work:working copilot claude-sonnet-4.6 2026-04-21 00:17:50 +0200 prompt output
✅ Fixed zbytes serialize return types (Any? → ByteArray?) and added @throws (ZError ctx_rec_32
zenoh-java:work:reviewing copilot gpt-5.4 2026-04-21 00:22:42 +0200 prompt output
❌ Review failed: Java ZBytes tests/examples still call newly checked serialize/des ctx_rec_33
zenoh-java:work:working claude claude-sonnet-4-6 2026-04-21 00:30:39 +0200 prompt output
zenoh-java:work:working copilot claude-sonnet-4.6 2026-04-21 00:30:50 +0200 prompt output
✅ Fixed Java ZBytes call sites: added throws ZError to all test methods in ZByte ctx_rec_34
zenoh-java:work:reviewing copilot gpt-5.4 2026-04-21 00:35:40 +0200 prompt output
✅ Review passed: the refactor consistently moves exception creation to zenoh-java, ctx_rec_35
zenoh-java:work:linting copilot gpt-5-mini 2026-04-21 00:40:50 +0200 prompt output
❌ Formatting/clippy checks: cargo fmt failed, cargo clippy passed ctx_rec_36
zenoh-java:work:linter_worker copilot claude-haiku-4.5 2026-04-21 00:46:41 +0200 prompt output
✅ Fixed all formatting issues. cargo fmt and cargo clippy checks now pass. ctx_rec_37
---CONTEXT---
user:milyin The initial task is done. The following correction are necessary: - restore mist... 2026-04-21 10:18:02 +0000 link
zenoh-java:plan:configuring copilot gpt-5-mini 2026-04-21 14:54:35 +0200 prompt output
✅ No destination branch override needed (destination remains common-jni) ctx_rec_1
zenoh-java:plan:planning claude_planner claude-sonnet-4-6 2026-04-21 14:57:19 +0200 prompt output
✅ Implementation plan created: two tasks — (1) restore removed Rust doc comment bl ctx_rec_2
zenoh-java:plan:plan_review_adversarial copilot gpt-5.4 2026-04-21 15:06:49 +0200 prompt output
❌ The plan is not ready: it misses the JVM/Android JNI byte-serialization surface ctx_rec_3
zenoh-java:plan:planning claude_planner claude-sonnet-4-6 2026-04-21 15:13:30 +0200 prompt output
✅ Implementation plan updated to include the missing JVM/Android zbytes surface (J ctx_rec_4
zenoh-java:plan:plan_review_adversarial copilot gpt-5.4 2026-04-21 15:19:26 +0200 prompt output
❌ The plan is not implementation-ready: it correctly adds the missing zbytes surfa ctx_rec_5
zenoh-java:plan:planning claude_planner claude-sonnet-4-6 2026-04-21 15:25:47 +0200 prompt output
✅ Implementation plan updated to fix ctx_rec_5 issue: zenoh-jni-runtime must NOT t ctx_rec_6
zenoh-java:plan:plan_review_adversarial copilot gpt-5.4 2026-04-21 15:33:01 +0200 prompt output
❌ The plan fixes the earlier layering error, but it still pushes raw JNI handles o ctx_rec_7
zenoh-java:plan:planning claude_planner claude-sonnet-4-6 2026-04-21 15:41:11 +0200 prompt output
✅ Implementation plan updated to fix ctx_rec_7 issue: the out parameter at the p ctx_rec_8
zenoh-java:plan:plan_review_adversarial copilot gpt-5.4 2026-04-21 15:49:27 +0200 prompt output
❌ The plan is close, but it still omits the scalar-return JNI contract and several ctx_rec_9
zenoh-java:plan:planning claude_planner claude-sonnet-4-6 2026-04-21 15:57:43 +0200 prompt output
zenoh-java:plan:planning copilot_planner claude-sonnet-4.6 2026-04-21 15:57:55 +0200 prompt output
✅ Final plan: adds scalar-return (IntArray out) rule, expands full surface list (J ctx_rec_10
zenoh-java:plan:plan_review_adversarial copilot gpt-5.4 2026-04-21 16:04:35 +0200 prompt output
❌ Plan is not implementation-ready: it omits the direct JNIPublisher surface and l ctx_rec_11
zenoh-java:plan:planning claude_planner claude-sonnet-4-6 2026-04-21 16:11:57 +0200 prompt output
✅ Final plan: adds explicit JNIPublisher chain (publisher.rs → JNIPublisher.kt → P ctx_rec_12
zenoh-java:plan:plan_review_adversarial copilot gpt-5.4 2026-04-21 16:17:35 +0200 prompt output
✅ The revised plan is sound and implementation-ready. I verified the current codeb ctx_rec_13
zenoh-java:work:working claude claude-sonnet-4-6 2026-04-21 16:30:57 +0200 prompt output
zenoh-java:work:working copilot claude-sonnet-4.6 2026-04-21 16:50:33 +0200 prompt output
✅ All JNI API migration complete: String? return pattern with typed out params. Bu ctx_rec_32
Update zenoh-java callers: Config.kt, Session.kt, Zenoh.kt, Logger.kt, KeyExpr.k ctx_rec_26
Update Rust files: ext/advanced_publisher.rs, ext/advanced_subscriber.rs to new ctx_rec_27
Update JNI runtime Kotlin files: JNIAdvancedPublisher, JNIAdvancedSubscriber, JN ctx_rec_28
Update JNI runtime Kotlin files to new String? API (JNIConfig, JNISession, JNIPu ctx_rec_29
Build and verify: gradlew build + grep checks for old error pattern ctx_rec_30
Update Rust files: zbytes.rs, zbytes_kotlin.rs, scouting.rs, logger.rs, zenoh_id ctx_rec_31
zenoh-java:work:reviewing copilot gpt-5.4 2026-04-21 17:31:56 +0200 prompt output
💬 Implementation looks correct and pattern-consistent; verification checklist item ctx_rec_38
The zenoh-jni-runtime in the common-jni branch (use it as destination) throws exceptions from the Rust code.
This is inconvenient for zenoh-kotlin library (in the different repo) which reuses zenoh-jni-runtime and have to wrap each jni call to runCatching.
The new JNI API functions will follow this pattern:
error. In case of error they return error variant value and seterrorstring to error message. In case of successerrorstays intactNo exception throwing from
zenoh-jni-runtimeanymore.No export of error type from
zenoh-jni-runtime.Error type export and throwing exception is performed on
zenoh-javalevel---PARAMETERS---
stack: [{"pipeline":"plan","calling_stage":"call_work"},{"pipeline":"plan","calling_stage":"working"}]
work_branch: zbobr_fix-75-throw-execptions-from-java
destination_branch: common-jni
pr_url: milyin-zenoh-zbobr/zenoh-java#6
state: pause
stage_count: 40
max_stage_count: 40
---STATUS---
❌ 2026-04-21 17:40:15 +0200 Stage count limit (40) reached - auto-paused
---DEAD_CONTEXT---
copilotgpt-5-mini2026-04-20 18:17:40 +0200prompt outputcopilotgpt-5-mini2026-04-20 22:02:59 +0200prompt outputclaude_plannerclaude-sonnet-4-62026-04-20 22:05:39 +0200prompt outputcopilotgpt-5.42026-04-20 22:18:31 +0200prompt outputclaude_plannerclaude-sonnet-4-62026-04-20 22:23:43 +0200prompt outputcopilotgpt-5.42026-04-20 22:31:56 +0200prompt outputclaude_plannerclaude-sonnet-4-62026-04-20 22:38:09 +0200prompt outputcopilotgpt-5.42026-04-20 22:46:05 +0200prompt outputclaudeclaude-sonnet-4-62026-04-20 23:21:19 +0200prompt outputcopilotclaude-sonnet-4.62026-04-20 23:30:19 +0200prompt outputcopilotgpt-5.42026-04-20 23:59:53 +0200prompt outputclaudeclaude-sonnet-4-62026-04-21 00:05:02 +0200prompt outputcopilotclaude-sonnet-4.62026-04-21 00:05:13 +0200prompt outputcopilotgpt-5.42026-04-21 00:12:32 +0200prompt outputclaudeclaude-sonnet-4-62026-04-21 00:17:39 +0200prompt outputcopilotclaude-sonnet-4.62026-04-21 00:17:50 +0200prompt outputcopilotgpt-5.42026-04-21 00:22:42 +0200prompt outputclaudeclaude-sonnet-4-62026-04-21 00:30:39 +0200prompt outputcopilotclaude-sonnet-4.62026-04-21 00:30:50 +0200prompt outputthrows ZErrorto all test methods in ZByte ctx_rec_34copilotgpt-5.42026-04-21 00:35:40 +0200prompt outputcopilotgpt-5-mini2026-04-21 00:40:50 +0200prompt outputcopilotclaude-haiku-4.52026-04-21 00:46:41 +0200prompt output---CONTEXT---
2026-04-21 10:18:02 +0000linkcopilotgpt-5-mini2026-04-21 14:54:35 +0200prompt outputclaude_plannerclaude-sonnet-4-62026-04-21 14:57:19 +0200prompt outputcopilotgpt-5.42026-04-21 15:06:49 +0200prompt outputclaude_plannerclaude-sonnet-4-62026-04-21 15:13:30 +0200prompt outputcopilotgpt-5.42026-04-21 15:19:26 +0200prompt outputclaude_plannerclaude-sonnet-4-62026-04-21 15:25:47 +0200prompt outputcopilotgpt-5.42026-04-21 15:33:01 +0200prompt outputclaude_plannerclaude-sonnet-4-62026-04-21 15:41:11 +0200prompt outputoutparameter at the p ctx_rec_8copilotgpt-5.42026-04-21 15:49:27 +0200prompt outputclaude_plannerclaude-sonnet-4-62026-04-21 15:57:43 +0200prompt outputcopilot_plannerclaude-sonnet-4.62026-04-21 15:57:55 +0200prompt outputcopilotgpt-5.42026-04-21 16:04:35 +0200prompt outputclaude_plannerclaude-sonnet-4-62026-04-21 16:11:57 +0200prompt outputcopilotgpt-5.42026-04-21 16:17:35 +0200prompt outputclaudeclaude-sonnet-4-62026-04-21 16:30:57 +0200prompt outputcopilotclaude-sonnet-4.62026-04-21 16:50:33 +0200prompt outputcopilotgpt-5.42026-04-21 17:31:56 +0200prompt output