Bug 720092 - java.lang.IndexOutOfBoundsException: getChars (0 ... 88168) ends beyond length 0. We do not know why this is happening yet. This patch catches the throw and logs what values we have for start and end. r=alexp AURORA_BASE_20120131
authorDoug Turner <dougt@dougt.org>
Tue, 31 Jan 2012 09:24:31 -0800
changeset 86687 bbc7014db2de
parent 86686 294b0fcf805b
child 86688 801015738a12
child 90255 ed29c74e3c01
push idunknown
push userunknown
push dateunknown
reviewersalexp
bugs720092, 88168
milestone12.0a1
Bug 720092 - java.lang.IndexOutOfBoundsException: getChars (0 ... 88168) ends beyond length 0. We do not know why this is happening yet. This patch catches the throw and logs what values we have for start and end. r=alexp
mobile/android/base/GeckoInputConnection.java
--- a/mobile/android/base/GeckoInputConnection.java
+++ b/mobile/android/base/GeckoInputConnection.java
@@ -201,18 +201,26 @@ public class GeckoInputConnection
             a = b;
             b = tmp;
         }
 
         extract.selectionStart = a;
         extract.selectionEnd = b;
 
         extract.startOffset = 0;
-        extract.text = content.toString();
 
+        try {
+            extract.text = content.toString();
+        } catch (IndexOutOfBoundsException iob) {
+            Log.d(LOGTAG,
+                  "IndexOutOfBoundsException thrown from getExtractedText(). start: " +
+                  Selection.getSelectionStart(content) +
+                  " end: " + Selection.getSelectionEnd(content));
+            return null;
+        }
         return extract;
     }
 
     @Override
     public boolean setSelection(int start, int end) {
         GeckoAppShell.sendEventToGecko(
             new GeckoEvent(GeckoEvent.IME_SET_SELECTION, start, end - start));