From 844725237dce8a5a26a7b8792b9c37860ed23fe5 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Mon, 18 May 2020 10:31:17 -0700 Subject: [PATCH] Add new ZT_ result codes that were added --- java/jni/ZT_jniutils.cpp | 13 +++++++++++-- java/src/com/zerotier/sdk/ResultCode.java | 15 ++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/java/jni/ZT_jniutils.cpp b/java/jni/ZT_jniutils.cpp index c52a2066b..3f7047795 100644 --- a/java/jni/ZT_jniutils.cpp +++ b/java/jni/ZT_jniutils.cpp @@ -44,6 +44,7 @@ jobject createResultObject(JNIEnv *env, ZT_ResultCode code) switch(code) { case ZT_RESULT_OK: + case ZT_RESULT_OK_IGNORED: LOGV("ZT_RESULT_OK"); fieldName = "RESULT_OK"; break; @@ -56,12 +57,20 @@ jobject createResultObject(JNIEnv *env, ZT_ResultCode code) fieldName = "RESULT_FATAL_ERROR_DATA_STORE_FAILED"; break; case ZT_RESULT_ERROR_NETWORK_NOT_FOUND: - LOGV("RESULT_FATAL_ERROR_DATA_STORE_FAILED"); + LOGV("ZT_RESULT_ERROR_NETWORK_NOT_FOUND"); fieldName = "RESULT_ERROR_NETWORK_NOT_FOUND"; break; + case ZT_RESULT_ERROR_UNSUPPORTED_OPERATION: + LOGV("ZT_RESULT_ERROR_UNSUPPORTED_OPERATION"); + fieldName = "RESULT_ERROR_UNSUPPORTED_OPERATION"; + break; + case ZT_RESULT_ERROR_BAD_PARAMETER: + LOGV("ZT_RESULT_ERROR_BAD_PARAMETER"); + fieldName = "ZT_RESULT_ERROR_BAD_PARAMETER"; + break; case ZT_RESULT_FATAL_ERROR_INTERNAL: default: - LOGV("RESULT_FATAL_ERROR_DATA_STORE_FAILED"); + LOGV("ZT_RESULT_FATAL_ERROR_INTERNAL"); fieldName = "RESULT_FATAL_ERROR_INTERNAL"; break; } diff --git a/java/src/com/zerotier/sdk/ResultCode.java b/java/src/com/zerotier/sdk/ResultCode.java index 5da82b319..66f575613 100644 --- a/java/src/com/zerotier/sdk/ResultCode.java +++ b/java/src/com/zerotier/sdk/ResultCode.java @@ -45,30 +45,35 @@ public enum ResultCode { /** * Ran out of memory */ - RESULT_FATAL_ERROR_OUT_OF_MEMORY(1), + RESULT_FATAL_ERROR_OUT_OF_MEMORY(100), /** * Data store is not writable or has failed */ - RESULT_FATAL_ERROR_DATA_STORE_FAILED(2), + RESULT_FATAL_ERROR_DATA_STORE_FAILED(101), /** * Internal error (e.g. unexpected exception indicating bug or build problem) */ - RESULT_FATAL_ERROR_INTERNAL(3), + RESULT_FATAL_ERROR_INTERNAL(102), // non-fatal errors /** * Network ID not valid */ - RESULT_ERROR_NETWORK_NOT_FOUND(1000); + RESULT_ERROR_NETWORK_NOT_FOUND(1000), + + RESULT_ERROR_UNSUPPORTED_OPERATION(1001), + + RESULT_ERROR_BAD_PARAMETER(1002); + private final int id; ResultCode(int id) { this.id = id; } public int getValue() { return id; } public boolean isFatal(int id) { - return (id > 0 && id < 1000); + return (id > 100 && id < 1000); } } \ No newline at end of file