Bug 692185 - Flush PrintWriter prior to extracting printed string; r=blassey
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 08 Nov 2011 16:41:50 -0500
changeset 80277 a2cb8a2bcff877cf7f133c22c6cfb2afc002c0f4
parent 80276 4b92a3b964460fbccda58f97fa2d5465ae821a56
child 80278 6c596531c7942f5c81b70e8b504b43cb6e821a30
push id323
push userrcampbell@mozilla.com
push dateTue, 15 Nov 2011 21:58:36 +0000
treeherderfx-team@3ea216303184 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs692185
milestone11.0a1
Bug 692185 - Flush PrintWriter prior to extracting printed string; r=blassey Not flushing the PrintWriter might cause data to get left in the PrintWriter's internal buffers, and not get written into the underlying StringWriter. This might explain why the stack trace does not get written out to the crash report.
embedding/android/GeckoApp.java
--- a/embedding/android/GeckoApp.java
+++ b/embedding/android/GeckoApp.java
@@ -353,17 +353,19 @@ abstract public class GeckoApp
             sTryCatchAttached = true;
             mMainHandler.post(new Runnable() {
                 public void run() {
                     try {
                         Looper.loop();
                     } catch (Exception e) {
                         Log.e(LOG_FILE_NAME, "top level exception", e);
                         StringWriter sw = new StringWriter();
-                        e.printStackTrace(new PrintWriter(sw));
+                        PrintWriter pw = new PrintWriter(sw);
+                        e.printStackTrace(pw);
+                        pw.flush();
                         GeckoAppShell.reportJavaCrash(sw.toString());
                     }
                     // resetting this is kinda pointless, but oh well
                     sTryCatchAttached = false;
                 }
             });
         }