bug 636602 - Android crash reporter crashes r=dougt a=blocking-fennec
authorBrad Lassey <blassey@mozilla.com>
Wed, 02 Mar 2011 10:50:23 -0500
changeset 63264 efbce8140bb4691e1465a919866decc151a82387
parent 63263 f4449a441aea3e465d6ea72eea12ee00bf3d5f8e
child 63265 72fa9452e56a7b0dd1702fb263702765a4cc43a6
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersdougt, blocking-fennec
bugs636602
milestone2.0b13pre
bug 636602 - Android crash reporter crashes r=dougt a=blocking-fennec
embedding/android/CrashReporter.java.in
--- a/embedding/android/CrashReporter.java.in
+++ b/embedding/android/CrashReporter.java.in
@@ -180,22 +180,25 @@ public class CrashReporter extends Activ
     // Generate some random numbers to fill out the boundary
     int r0 = (int)((double)Integer.MAX_VALUE * Math.random());
     int r1 = (int)((double)Integer.MAX_VALUE * Math.random());
 
     return String.format("---------------------------%08X%08X", r0, r1);
   }
 
   void sendPart(OutputStream os, String boundary, String name, String data)
-    throws IOException
   {
-    os.write(("--" + boundary + "\r\n" +
-              "Content-Disposition: form-data; name=\"" +
-              name + "\"\r\n\r\n" +
-              data + "\r\n").getBytes());
+    try {
+      os.write(("--" + boundary + "\r\n" +
+                "Content-Disposition: form-data; name=\"" +
+                name + "\"\r\n\r\n" +
+                data + "\r\n").getBytes());
+    } catch (Exception ex) {
+      Log.e("GeckoCrashReporter", "Exception when sending \"" + name + "\"", ex);
+    }
   }
 
   void sendFile(OutputStream os, String boundary, String name, File file)
     throws IOException
   {
     os.write(("--" + boundary + "\r\n" +
               "Content-Disposition: form-data; " +
               "name=\"" + name + "\"; " +
@@ -250,23 +253,28 @@ public class CrashReporter extends Activ
       notes += Build.FINGERPRINT;
       sendPart(os, boundary, kNotesKey, notes);
 
       sendPart(os, boundary, "Min_ARM_Version", "@MOZ_MIN_CPU_VERSION@");
       sendPart(os, boundary, "Android_Manufacturer", Build.MANUFACTURER);
       sendPart(os, boundary, "Android_Model", Build.MODEL);
       sendPart(os, boundary, "Android_Board", Build.BOARD);
       sendPart(os, boundary, "Android_Brand", Build.BRAND);
-      sendPart(os, boundary, "Android_CPU_ABI", Build.CPU_ABI); 
-      sendPart(os, boundary, "Android_CPU_ABI2", Build.CPU_ABI2);
       sendPart(os, boundary, "Android_Device", Build.DEVICE);
       sendPart(os, boundary, "Android_Display", Build.DISPLAY);
       sendPart(os, boundary, "Android_Fingerprint", Build.FINGERPRINT);
-      if (Build.VERSION.SDK_INT >= 8)
-        sendPart(os, boundary, "Android_Hardware", Build.HARDWARE);
+      sendPart(os, boundary, "Android_CPU_ABI", Build.CPU_ABI); 
+      if (Build.VERSION.SDK_INT >= 8) {
+        try {
+          sendPart(os, boundary, "Android_CPU_ABI2", Build.CPU_ABI2);
+          sendPart(os, boundary, "Android_Hardware", Build.HARDWARE);
+        } catch (Exception ex) {
+          Log.e("GeckoCrashReporter", "Exception while sending SDK version 8 keys", ex);
+        }
+      }
       sendPart(os, boundary, "Android_Version",  Build.VERSION.SDK_INT + " (" + Build.VERSION.CODENAME + ")");
 
       sendFile(os, boundary, kMiniDumpPathKey, minidumpFile);
       os.write(("\r\n--" + boundary + "--\r\n").getBytes());
       os.flush();
       os.close();
       BufferedReader br = new BufferedReader(
         new InputStreamReader(conn.getInputStream()));