mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-03 21:55:13 +00:00
Cleanup
This commit is contained in:
parent
d8a34f680f
commit
2b00772111
1 changed files with 3 additions and 34 deletions
|
@ -33,9 +33,9 @@ public class ThrowableWrapper extends Throwable {
|
|||
private String msg;
|
||||
private final Throwable ex;
|
||||
|
||||
public static native String jni_get_safe_message(Throwable ex);
|
||||
public static native String jni_get_safe_message(Throwable ex); // TODO CASA
|
||||
|
||||
public static native String jni_get_safe_stack_trace_string(Throwable ex);
|
||||
public static native String jni_get_safe_stack_trace_string(Throwable ex); // TODO CASA
|
||||
|
||||
static {
|
||||
System.loadLibrary("fairemail");
|
||||
|
@ -67,38 +67,7 @@ public class ThrowableWrapper extends Throwable {
|
|||
}
|
||||
|
||||
public String getSafeStackTraceString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
StackTraceElement[] stack = ex.getStackTrace();
|
||||
for (StackTraceElement traceElement : stack)
|
||||
sb.append("\tat ").append(traceElement).append('\n');
|
||||
|
||||
Throwable cause = ex.getCause();
|
||||
StackTraceElement[] enclosing = stack;
|
||||
while (cause != null) {
|
||||
sb.append("Caused by: ").append('\n');
|
||||
|
||||
stack = cause.getStackTrace();
|
||||
|
||||
int m = stack.length - 1;
|
||||
int n = enclosing.length - 1;
|
||||
while (m >= 0 && n >= 0 && stack[m].equals(enclosing[n])) {
|
||||
m--;
|
||||
n--;
|
||||
}
|
||||
|
||||
int common = stack.length - 1 - m;
|
||||
|
||||
for (int i = 0; i <= m; i++)
|
||||
sb.append("\tat ").append(stack[i]).append('\n');
|
||||
if (common != 0)
|
||||
sb.append("\t... ").append(common).append(" more").append('\n');
|
||||
|
||||
enclosing = stack;
|
||||
cause = cause.getCause();
|
||||
}
|
||||
|
||||
return sb.toString(); //jni_get_safe_stack_trace_string(ex);
|
||||
return jni_get_safe_stack_trace_string(ex);
|
||||
}
|
||||
|
||||
public String toSafeString() {
|
||||
|
|
Loading…
Reference in a new issue