[3.4.0-map-sdk] code safe
This commit is contained in:
@@ -35,7 +35,7 @@ public class CrashSystem implements UncaughtExceptionHandler {
|
||||
private String mOsVersion = null;
|
||||
private String mDeviceId = null;
|
||||
private UncaughtExceptionHandler mDefaultHandler;
|
||||
private final Map<String, String> info = new HashMap();
|
||||
private final Map<String, String> info = new HashMap<>();
|
||||
private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
|
||||
private boolean mDebug = false;
|
||||
private final List<CrashCallback> callbackList = new ArrayList<>();
|
||||
@@ -109,15 +109,13 @@ public class CrashSystem implements UncaughtExceptionHandler {
|
||||
}
|
||||
|
||||
private boolean handleException(Throwable ex) {
|
||||
if(ex == null) {
|
||||
return true;
|
||||
} else {
|
||||
if (ex != null) {
|
||||
String msg = ex.getLocalizedMessage();
|
||||
Log.e("CrashSystem", msg);
|
||||
String filePath = saveCrashInfo2File(ex);
|
||||
Log.i(TAG, "handleException: filePath = " + filePath);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String saveCrashInfo2File(Throwable ex) {
|
||||
@@ -148,7 +146,7 @@ public class CrashSystem implements UncaughtExceptionHandler {
|
||||
result = entry.getValue();
|
||||
sb.append(key).append("=").append(result).append("\n");
|
||||
}
|
||||
sb.append("TIME=").append(String.valueOf(System.currentTimeMillis())).append("\n");
|
||||
sb.append("TIME=").append(System.currentTimeMillis()).append("\n");
|
||||
sb.append("fileName=").append(fileName).append("\n");
|
||||
Writer writer = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(writer);
|
||||
@@ -187,7 +185,7 @@ public class CrashSystem implements UncaughtExceptionHandler {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
try {
|
||||
PackageInfo packageInfo = pm.getPackageInfo(this.mAppPackage, 0);
|
||||
this.mAppVersionCode = "" + packageInfo.versionCode;
|
||||
this.mAppVersionCode = String.valueOf(packageInfo.versionCode);
|
||||
this.mAppVersionName = packageInfo.versionName;
|
||||
this.mAppPackage = packageInfo.packageName;
|
||||
this.mAppName = packageInfo.applicationInfo.loadLabel(context.getPackageManager()).toString();
|
||||
|
||||
Reference in New Issue
Block a user