Source

Target

Showing with 27 additions and 7 deletions
......@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This changelog file was started on October 2019. Previous changes were more or less tracked in the *NEWS* file.
## [5.1.0] Unreleased
### Changed
- Java wrapper no longer catches app exceptions that happens in listener
## [5.0.0] 2021-07-08
### Added
......
......@@ -975,7 +975,7 @@ static void process_response_from_post_file_log_collection(void *data, const bel
char *first_part_header;
belle_sip_user_body_handler_t *first_part_bh;
linphone_core_notify_log_collection_upload_state_changed(core, LinphoneCoreLogCollectionUploadStateInProgress, NULL);
linphone_core_notify_log_collection_upload_state_changed(core, LinphoneCoreLogCollectionUploadStateInProgress, "In progress");
/* Temporary storage for the Content-disposition header value */
first_part_header = belle_sip_strdup_printf("form-data; name=\"File\"; filename=\"%s\"", linphone_content_get_name(core->log_collection_upload_information));
......@@ -1163,6 +1163,8 @@ void linphone_core_upload_log_collection(LinphoneCore *core) {
msg = "Log collection upload server not set";
} else if (liblinphone_log_collection_state == LinphoneLogCollectionDisabled) {
msg = "Log collection is disabled";
} else {
msg = "Unknown error";
}
linphone_core_notify_log_collection_upload_state_changed(core, LinphoneCoreLogCollectionUploadStateNotDelivered, msg);
}
......
......@@ -244,6 +244,9 @@ public:
ms_factory_class = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/mediastream/Factory"));
ms_factory_class_constructor = env->GetMethodID(ms_factory_class, "<init>", "(J)V");
throwable_class = (jclass)env->NewGlobalRef(env->FindClass("java/lang/Throwable"));
throwable_to_string = env->GetMethodID(throwable_class, "toString", "()Ljava/lang/String;");
{{#objects}}
{{cPrefix}}_class = (jclass)env->NewGlobalRef(env->FindClass("{{jniPath}}{{classImplName}}"));
{{cPrefix}}_class_constructor = env->GetMethodID({{cPrefix}}_class, "<init>", "(JZ)V");
......@@ -257,11 +260,12 @@ public:
~LinphoneJavaBindings() {
JNIEnv *env = ms_get_jni_env();
if (!env) {
bctbx_error("cannot attach VM");
}
if (!env) {
bctbx_error("cannot attach VM");
}
env->DeleteGlobalRef(ms_factory_class);
env->DeleteGlobalRef(throwable_class);
{{#objects}}
env->DeleteGlobalRef({{cPrefix}}_class);
......@@ -275,6 +279,9 @@ public:
jclass ms_factory_class;
jmethodID ms_factory_class_constructor;
jclass throwable_class;
jmethodID throwable_to_string;
{{#objects}}
jclass {{cPrefix}}_class;
jmethodID {{cPrefix}}_class_constructor;
......@@ -356,12 +363,18 @@ JNIEXPORT jboolean JNICALL Java_{{jniPrefix}}{{classImplName}}_unref(JNIEnv* env
{{/objects}}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static inline void handle_possible_java_exception(JNIEnv *env, jobject listener)
static inline void handle_possible_java_exception(JNIEnv *env, jobject listener, const char *listener_name)
{
if (env->ExceptionCheck()) {
env->ExceptionDescribe();
jthrowable exception = env->ExceptionOccurred();
env->ExceptionClear();
bctbx_error("Listener %p raised an exception", listener);
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_factory_get_user_data(linphone_factory_get());
jstring toString = (jstring) env->CallObjectMethod(exception, ljb->throwable_to_string);
const char * toStringChar = GetStringUTFChars(env, toString);
bctbx_error("Listener %s [%p] raised an exception: %s", listener_name, listener, toStringChar);
ReleaseStringUTFChars(env, toString, toStringChar);
}
}
......@@ -458,7 +471,7 @@ static {{return}} {{callbackName}}({{params}}) {
}
{{/jstrings}}
handle_possible_java_exception(env, jlistener);
//handle_possible_java_exception(env, jlistener, "{{callbackName}}");
{{#hasReturn}}
return c_upcall_result;
{{/hasReturn}}
......