Bug 1051556 - Simplify GeckoEditable exception messages. r=snorp, a=lmandel
authorEugen Sawin <esawin@mozilla.com>
Wed, 04 Mar 2015 23:15:14 +0100
changeset 250317 73c7414f883d
parent 250316 8628f482efe0
child 250318 d59086707825
push id4544
push userryanvm@gmail.com
push date2015-03-09 19:49 +0000
treeherdermozilla-beta@d59086707825 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, lmandel
bugs1051556
milestone37.0
Bug 1051556 - Simplify GeckoEditable exception messages. r=snorp, a=lmandel
mobile/android/base/GeckoEditable.java
--- a/mobile/android/base/GeckoEditable.java
+++ b/mobile/android/base/GeckoEditable.java
@@ -112,18 +112,18 @@ final class GeckoEditable
         Handler mHandler;
 
         Action(int type) {
             mType = type;
         }
 
         static Action newReplaceText(CharSequence text, int start, int end) {
             if (start < 0 || start > end) {
-                throw new IllegalArgumentException(
-                    "invalid replace text offsets: " + start + " to " + end);
+                Log.e(LOGTAG, "invalid replace text offsets: " + start + " to " + end);
+                throw new IllegalArgumentException("invalid replace text offsets");
             }
 
             int actionType = TYPE_REPLACE_TEXT;
 
             if (text instanceof Spanned) {
                 final Spanned spanned = (Spanned) text;
                 final Object[] spans = spanned.getSpans(0, spanned.length(), Object.class);
 
@@ -141,29 +141,29 @@ final class GeckoEditable
             action.mEnd = end;
             return action;
         }
 
         static Action newSetSelection(int start, int end) {
             // start == -1 when the start offset should remain the same
             // end == -1 when the end offset should remain the same
             if (start < -1 || end < -1) {
-                throw new IllegalArgumentException(
-                    "invalid selection offsets: " + start + " to " + end);
+                Log.e(LOGTAG, "invalid selection offsets: " + start + " to " + end);
+                throw new IllegalArgumentException("invalid selection offsets");
             }
             final Action action = new Action(TYPE_SET_SELECTION);
             action.mStart = start;
             action.mEnd = end;
             return action;
         }
 
         static Action newSetSpan(Object object, int start, int end, int flags) {
             if (start < 0 || start > end) {
-                throw new IllegalArgumentException(
-                    "invalid span offsets: " + start + " to " + end);
+                Log.e(LOGTAG, "invalid span offsets: " + start + " to " + end);
+                throw new IllegalArgumentException("invalid span offsets");
             }
             final Action action = new Action(TYPE_SET_SPAN);
             action.mSpanObject = object;
             action.mStart = start;
             action.mEnd = end;
             action.mSpanFlags = flags;
             return action;
         }
@@ -815,18 +815,19 @@ final class GeckoEditable
     @Override
     public void onSelectionChange(final int start, final int end) {
         if (DEBUG) {
             // GeckoEditableListener methods should all be called from the Gecko thread
             ThreadUtils.assertOnGeckoThread();
             Log.d(LOGTAG, "onSelectionChange(" + start + ", " + end + ")");
         }
         if (start < 0 || start > mText.length() || end < 0 || end > mText.length()) {
-            throw new IllegalArgumentException("invalid selection notification range: " +
-                start + " to " + end + ", length: " + mText.length());
+            Log.e(LOGTAG, "invalid selection notification range: " +
+                  start + " to " + end + ", length: " + mText.length());
+            throw new IllegalArgumentException("invalid selection notification range");
         }
         final int seqnoWhenPosted = ++mGeckoUpdateSeqno;
 
         /* An event (keypress, etc.) has potentially changed the selection,
            synchronize the selection here. There is not a race with the IC thread
            because the IC thread should be blocked on the event action */
         if (!mActionQueue.isEmpty() &&
             mActionQueue.peek().mType == Action.TYPE_EVENT) {
@@ -871,26 +872,28 @@ final class GeckoEditable
             StringBuilder sb = new StringBuilder("onTextChange(");
             debugAppend(sb, text);
             sb.append(", ").append(start).append(", ")
                 .append(unboundedOldEnd).append(", ")
                 .append(unboundedNewEnd).append(")");
             Log.d(LOGTAG, sb.toString());
         }
         if (start < 0 || start > unboundedOldEnd) {
-            throw new IllegalArgumentException("invalid text notification range: " +
-                start + " to " + unboundedOldEnd);
+            Log.e(LOGTAG, "invalid text notification range: " +
+                  start + " to " + unboundedOldEnd);
+            throw new IllegalArgumentException("invalid text notification range");
         }
         /* For the "end" parameters, Gecko can pass in a large
            number to denote "end of the text". Fix that here */
         final int oldEnd = unboundedOldEnd > mText.length() ? mText.length() : unboundedOldEnd;
         // new end should always match text
         if (start != 0 && unboundedNewEnd != (start + text.length())) {
-            throw new IllegalArgumentException("newEnd does not match text: " +
-                unboundedNewEnd + " vs " + (start + text.length()));
+            Log.e(LOGTAG, "newEnd does not match text: " + unboundedNewEnd + " vs " +
+                  (start + text.length()));
+            throw new IllegalArgumentException("newEnd does not match text");
         }
         final int newEnd = start + text.length();
 
         /* Text changes affect the selection as well, and we may not receive another selection
            update as a result of selection notification masking on the Gecko side; therefore,
            in order to prevent previous stale selection notifications from occurring, we need
            to increment the seqno here as well */
         ++mGeckoUpdateSeqno;
@@ -1115,18 +1118,19 @@ final class GeckoEditable
     }
 
     @Override
     public Editable replace(int st, int en,
             CharSequence source, int start, int end) {
 
         CharSequence text = source;
         if (start < 0 || start > end || end > text.length()) {
-            throw new IllegalArgumentException("invalid replace offsets: " +
-                start + " to " + end + ", length: " + text.length());
+            Log.e(LOGTAG, "invalid replace offsets: " +
+                  start + " to " + end + ", length: " + text.length());
+            throw new IllegalArgumentException("invalid replace offsets");
         }
         if (start != 0 || end != text.length()) {
             text = text.subSequence(start, end);
         }
         if (mFilters != null) {
             // Filter text before sending the request to Gecko
             for (int i = 0; i < mFilters.length; ++i) {
                 final CharSequence cs = mFilters[i].filter(