From e854c0f907082438efcc9078785093e46d4c1f97 Mon Sep 17 00:00:00 2001 From: Valere Date: Thu, 2 Dec 2021 17:48:47 +0100 Subject: [PATCH] Quick fixes --- .../src/main/java/org/matrix/olm/OlmAccount.java | 1 + android/olm-sdk/src/main/jni/olm_account.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/android/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java b/android/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java index 3e8c63e..c847970 100644 --- a/android/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java +++ b/android/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java @@ -501,6 +501,7 @@ public class OlmAccount extends CommonSerializeUtils implements Serializable { * This should be called once you are reasonably certain that you will not * receive any more messages that use the old fallback key (e.g. 5 minutes * after the new fallback key has been published). + * @throws OlmException the failure reason **/ public void forgetFallbackKey() throws OlmException { try { diff --git a/android/olm-sdk/src/main/jni/olm_account.cpp b/android/olm-sdk/src/main/jni/olm_account.cpp index d3a42e1..a4f1d33 100644 --- a/android/olm-sdk/src/main/jni/olm_account.cpp +++ b/android/olm-sdk/src/main/jni/olm_account.cpp @@ -577,6 +577,7 @@ JNIEXPORT jbyteArray OLM_ACCOUNT_FUNC_DEF(fallbackKeyJni)(JNIEnv *env, jobject t **/ JNIEXPORT void OLM_ACCOUNT_FUNC_DEF(forgetFallbackKeyJni)(JNIEnv *env, jobject thiz) { + const char* errorMessage = NULL; OlmAccount *accountPtr = getAccountInstanceId(env, thiz); if (!accountPtr) @@ -586,8 +587,14 @@ JNIEXPORT void OLM_ACCOUNT_FUNC_DEF(forgetFallbackKeyJni)(JNIEnv *env, jobject t } else { - olm_account_forget_old_fallback_key(accountPtr) + olm_account_forget_old_fallback_key(accountPtr); } + + if (errorMessage) + { + env->ThrowNew(env->FindClass("java/lang/Exception"), errorMessage); + } + } /** @@ -643,7 +650,7 @@ JNIEXPORT jbyteArray OLM_ACCOUNT_FUNC_DEF(signMessageJni)(JNIEnv *env, jobject t else { LOGD("## signMessageJni(): success - retCode=%lu signatureLength=%lu", static_cast(resultSign), static_cast(signatureLength)); - + signedMsgRetValueBuffer = env->NewByteArray(signatureLength); env->SetByteArrayRegion(signedMsgRetValueBuffer, 0 , signatureLength, (jbyte*)signedMsgPtr); }