钱能钱包 v3.10.2版本的 MD5 值为:339a4b585ef2aa3bfaf7e4baeb254647
以下内容为反编译后的 BaseJavaCrashHandler.java 源代码,内容仅作参考
package com.netease.nis.basesdk.crash;
import android.os.Process;
import android.util.Log;
import com.netease.nis.basesdk.HttpUtil;
import com.netease.nis.basesdk.Logger;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.lang.Thread;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public abstract class BaseJavaCrashHandler implements Thread.UncaughtExceptionHandler {
private String a = "https://crash.163.com/uploadCrashLogInfo.do";
private String f5887b = "https://crash.163.com/client/api/uploadStartUpInfo.do";
private Thread.UncaughtExceptionHandler f5888c;
private CrashStore f5889d;
public class a implements HttpUtil.ResponseCallBack {
public a(BaseJavaCrashHandler baseJavaCrashHandler) {
}
@Override
public void onError(int i2, String str) {
Logger.i("BaseJavaCrashHandler", "start error" + str);
}
@Override
public void onSuccess(String str) {
Logger.i("BaseJavaCrashHandler", "start success");
}
}
public class b implements HttpUtil.ResponseCallBack {
public final String a;
public b(String str) {
this.a = str;
}
@Override
public void onError(int i2, String str) {
Logger.e("upload crash info failed,error code:" + i2 + " msg:" + str);
}
@Override
public void onSuccess(String str) {
Logger.d("upload crash info success" + this.a);
BaseJavaCrashHandler.this.f5889d.delete(this.a);
}
}
public abstract Map<String, String> buildCrashInfo(String str);
public abstract Map<String, String> buildStartInfo();
public void initialize(String str) {
this.f5888c = Thread.getDefaultUncaughtExceptionHandler();
try {
Thread.setDefaultUncaughtExceptionHandler(this);
} catch (Exception e2) {
Logger.e("BaseJavaCrashHandler", "JavaCrashHandler setDefaultUncaughtExceptionHandler failed" + e2.getMessage());
}
CrashStore crashStore = CrashStore.getInstance();
this.f5889d = crashStore;
crashStore.initialize(str);
if (buildStartInfo() != null) {
new Thread(new e.f.e.a.a.a(buildStartInfo(), this.f5887b, new a(this))).start();
}
a();
}
public boolean interceptHandleException(Throwable th) {
return false;
}
public void setStartUrl(String str) {
this.f5887b = str;
}
public void setUploadUrl(String str) {
this.a = str;
}
public void testCrash() {
throw new RuntimeException("test java exception");
}
@Override
public void uncaughtException(Thread thread, Throwable th) {
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = this.f5888c;
if (uncaughtExceptionHandler != null) {
Thread.setDefaultUncaughtExceptionHandler(uncaughtExceptionHandler);
}
try {
if (!interceptHandleException(th)) {
a(thread, th);
}
} catch (Exception e2) {
Logger.e("BaseJavaCrashHandler", "JavaCrashHandler handleException failed" + e2.getMessage());
}
Thread.UncaughtExceptionHandler uncaughtExceptionHandler2 = this.f5888c;
if (uncaughtExceptionHandler2 != null) {
uncaughtExceptionHandler2.uncaughtException(thread, th);
return;
}
Process.killProcess(Process.myPid());
System.exit(10);
}
private void a() {
Logger.d("check and report crash info");
File[] loadJava = this.f5889d.loadJava();
if (loadJava.length > 0) {
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(0, 5, 5L, TimeUnit.SECONDS, new ArrayBlockingQueue(10), Executors.defaultThreadFactory(), new ThreadPoolExecutor.DiscardPolicy());
for (File file : loadJava) {
try {
threadPoolExecutor.execute(a(this.f5889d.parse(file.getAbsolutePath()), file.getAbsolutePath()));
} catch (UnsupportedEncodingException unused) {
Logger.e("BaseJavaCrashHandler", "logInfo encode error");
}
}
}
}
private void a(Thread thread, Throwable th) {
try {
a(this.f5889d.store(Log.getStackTraceString(th)).getAbsolutePath());
} catch (UnsupportedEncodingException unused) {
Logger.e("BaseJavaCrashHandler", "logInfo encode error");
}
}
private void a(String str) {
String parse = this.f5889d.parse(str);
Logger.d(parse);
Thread thread = new Thread(a(parse, str));
thread.start();
try {
thread.join(3000L);
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
Logger.e("quick upload isInterrupted");
}
}
private CrashReportRunnable a(String str, String str2) {
return new CrashReportRunnable(buildCrashInfo(str), this.a, new b(str2));
}
}