Simplification

This commit is contained in:
M66B 2023-12-14 18:35:04 +01:00
parent 2810115d2f
commit d47e5ec10c
2 changed files with 3 additions and 12 deletions

View File

@ -35,8 +35,6 @@ public class ThrowableWrapper extends Throwable {
public static native String jni_get_safe_message(Throwable ex);
public static native String jni_to_safe_string(Throwable ex);
public static native String jni_get_safe_stack_trace_string(Throwable ex);
static {
@ -73,7 +71,9 @@ public class ThrowableWrapper extends Throwable {
}
public String toSafeString() {
return jni_to_safe_string(ex);
String name = ex.getClass().getName();
String message = getSafeMessage();
return (message == null ? name : (name + ": " + message));
}
@Nullable

View File

@ -32,15 +32,6 @@ Java_eu_faircode_email_ThrowableWrapper_jni_1get_1safe_1message(
return (jstring) env->CallObjectMethod(ex, mid);
}
extern "C"
JNIEXPORT jstring JNICALL
Java_eu_faircode_email_ThrowableWrapper_jni_1to_1safe_1string(
JNIEnv *env, jclass clazz, jthrowable ex) {
jclass cls = env->FindClass("java/lang/Throwable");
jmethodID mid = env->GetMethodID(cls, "toString", "()Ljava/lang/String;");
return (jstring) env->CallObjectMethod(ex, mid);
}
extern "C"
JNIEXPORT jstring JNICALL
Java_eu_faircode_email_ThrowableWrapper_jni_1get_1safe_1stack_1trace_1string(