/** * Store a report * * @param file the file to store in * @param crashData the content */ private void saveCrashReportFile(@NonNull File file, @NonNull CrashReportData crashData) { try { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Writing crash report file " + file); final CrashReportPersister persister = new CrashReportPersister(); persister.store(crashData, file); } catch (Exception e) { ACRA.log.e(LOG_TAG, "An error occurred while writing the report file...", e); } } }
final CrashReportData data = legacyLoad(new InputStreamReader(in, "ISO8859-1")); //$NON-NLS-1$ if (data.containsKey(ReportField.REPORT_ID) && data.containsKey(ReportField.USER_CRASH_DATE)) { persister.store(data, report); converted++; } else {
final CrashReportData crashData = persister.load(reportFile); crashData.put(USER_COMMENT, comment.toString()); persister.store(crashData, reportFile); } catch (@NonNull IOException | JSONException e) { ACRA.log.w(LOG_TAG, "User comment not added: ", e);
/** * Send crash report given user's comment and email address. * * @param comment Comment (may be null) provided by the user. * @param userEmail Email address (may be null) provided by the client. */ protected final void sendCrash(@Nullable String comment, @Nullable String userEmail) { new Thread(() -> { final CrashReportPersister persister = new CrashReportPersister(); try { if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "Add user comment to " + reportFile); final CrashReportData crashData = persister.load(reportFile); crashData.put(USER_COMMENT, comment == null ? "" : comment); crashData.put(USER_EMAIL, userEmail == null ? "" : userEmail); persister.store(crashData, reportFile); } catch (IOException | JSONException e) { ACRA.log.w(LOG_TAG, "User comment not added: ", e); } // Start the report sending task new SchedulerStarter(this, config).scheduleReports(reportFile, false); }).start(); }