java.lang.IndexOutOfBoundsException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • h2. Problem description When trying to paste a string that is larger than the maximum allowed for a text field (e.g. greater than maxLength), the app crashes. h2. Steps to reproduce USe the following code. The text field has a max length of 10 characters. Copy a string of at least 11 (e.g. '12345678910') and paste into it. The app will immediatly crash. Works fine in native Android. h2. Error Log 06-01 07:19:59.548: E/TiApplication(18418): (main) [12162,12162] Sending event: exception on thread: main msg:java.lang.IndexOutOfBoundsException: setSpan (10 ... 10) ends beyond length 0; Titanium 3.1.0,2013/04/15 18:46,57634ef 06-01 07:19:59.548: E/TiApplication(18418): java.lang.IndexOutOfBoundsException: setSpan (10 ... 10) ends beyond length 0 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1016) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:592) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:588) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.Selection.setSelection(Selection.java:76) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.Selection.setSelection(Selection.java:87) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.EditText.setSelection(EditText.java:94) 06-01 07:19:59.548: E/TiApplication(18418): at ti.modules.titanium.ui.widget.TiUIText.onTextChanged(TiUIText.java:285) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.TextView.sendOnTextChanged(TextView.java:7231) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.TextView.handleTextChanged(TextView.java:7290) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:8880) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.TextView.paste(TextView.java:8275) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.TextView.onTextContextMenuItem(TextView.java:8036) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.Editor$ActionPopupWindow.onClick(Editor.java:2862) 06-01 07:19:59.548: E/TiApplication(18418): at android.view.View.performClick(View.java:4204) 06-01 07:19:59.548: E/TiApplication(18418): at android.view.View$PerformClick.run(View.java:17355) 06-01 07:19:59.548: E/TiApplication(18418): at android.os.Handler.handleCallback(Handler.java:725) 06-01 07:19:59.548: E/TiApplication(18418): at android.os.Handler.dispatchMessage(Handler.java:92) 06-01 07:19:59.548: E/TiApplication(18418): at android.os.Looper.loop(Looper.java:137) 06-01 07:19:59.548: E/TiApplication(18418): at android.app.ActivityThread.main(ActivityThread.java:5041) 06-01 07:19:59.548: E/TiApplication(18418): at java.lang.reflect.Method.invokeNative(Native Method) 06-01 07:19:59.548: E/TiApplication(18418): at java.lang.reflect.Method.invoke(Method.java:511) 06-01 07:19:59.548: E/TiApplication(18418): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 06-01 07:19:59.548: E/TiApplication(18418): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 06-01 07:19:59.548: E/TiApplication(18418): at dalvik.system.NativeStart.main(Native Method) 06-01 07:19:59.588: E/AndroidRuntime(18418): FATAL EXCEPTION: main 06-01 07:19:59.588: E/AndroidRuntime(18418): java.lang.IndexOutOfBoundsException: setSpan (10 ... 10) ends beyond length 0 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1016) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:592) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:588) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.Selection.setSelection(Selection.java:76) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.Selection.setSelection(Selection.java:87) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.EditText.setSelection(EditText.java:94) 06-01 07:19:59.588: E/AndroidRuntime(18418): at ti.modules.titanium.ui.widget.TiUIText.onTextChanged(TiUIText.java:285) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.TextView.sendOnTextChanged(TextView.java:7231) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.TextView.handleTextChanged(TextView.java:7290) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:8880) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.TextView.paste(TextView.java:8275) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.TextView.onTextContextMenuItem(TextView.java:8036) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.Editor$ActionPopupWindow.onClick(Editor.java:2862) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.view.View.performClick(View.java:4204) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.view.View$PerformClick.run(View.java:17355) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.os.Handler.handleCallback(Handler.java:725) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.os.Handler.dispatchMessage(Handler.java:92) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.os.Looper.loop(Looper.java:137) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.app.ActivityThread.main(ActivityThread.java:5041) 06-01 07:19:59.588: E/AndroidRuntime(18418): at java.lang.reflect.Method.invokeNative(Native Method) 06-01 07:19:59.588: E/AndroidRuntime(18418): at java.lang.reflect.Method.invoke(Method.java:511) 06-01 07:19:59.588: E/AndroidRuntime(18418): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 06-01 07:19:59.588: E/AndroidRuntime(18418): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 06-01 07:19:59.588: E/AndroidRuntime(18418): at dalvik.system.NativeStart.main(Native Method)
    via by Davide Cassenti,
  • h2. Problem description When trying to paste a string that is larger than the maximum allowed for a text field (e.g. greater than maxLength), the app crashes. h2. Steps to reproduce USe the following code. The text field has a max length of 10 characters. Copy a string of at least 11 (e.g. '12345678910') and paste into it. The app will immediatly crash. Works fine in native Android. h2. Error Log 06-01 07:19:59.548: E/TiApplication(18418): (main) [12162,12162] Sending event: exception on thread: main msg:java.lang.IndexOutOfBoundsException: setSpan (10 ... 10) ends beyond length 0; Titanium 3.1.0,2013/04/15 18:46,57634ef 06-01 07:19:59.548: E/TiApplication(18418): java.lang.IndexOutOfBoundsException: setSpan (10 ... 10) ends beyond length 0 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1016) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:592) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:588) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.Selection.setSelection(Selection.java:76) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.Selection.setSelection(Selection.java:87) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.EditText.setSelection(EditText.java:94) 06-01 07:19:59.548: E/TiApplication(18418): at ti.modules.titanium.ui.widget.TiUIText.onTextChanged(TiUIText.java:285) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.TextView.sendOnTextChanged(TextView.java:7231) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.TextView.handleTextChanged(TextView.java:7290) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:8880) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435) 06-01 07:19:59.548: E/TiApplication(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.TextView.paste(TextView.java:8275) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.TextView.onTextContextMenuItem(TextView.java:8036) 06-01 07:19:59.548: E/TiApplication(18418): at android.widget.Editor$ActionPopupWindow.onClick(Editor.java:2862) 06-01 07:19:59.548: E/TiApplication(18418): at android.view.View.performClick(View.java:4204) 06-01 07:19:59.548: E/TiApplication(18418): at android.view.View$PerformClick.run(View.java:17355) 06-01 07:19:59.548: E/TiApplication(18418): at android.os.Handler.handleCallback(Handler.java:725) 06-01 07:19:59.548: E/TiApplication(18418): at android.os.Handler.dispatchMessage(Handler.java:92) 06-01 07:19:59.548: E/TiApplication(18418): at android.os.Looper.loop(Looper.java:137) 06-01 07:19:59.548: E/TiApplication(18418): at android.app.ActivityThread.main(ActivityThread.java:5041) 06-01 07:19:59.548: E/TiApplication(18418): at java.lang.reflect.Method.invokeNative(Native Method) 06-01 07:19:59.548: E/TiApplication(18418): at java.lang.reflect.Method.invoke(Method.java:511) 06-01 07:19:59.548: E/TiApplication(18418): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 06-01 07:19:59.548: E/TiApplication(18418): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 06-01 07:19:59.548: E/TiApplication(18418): at dalvik.system.NativeStart.main(Native Method) 06-01 07:19:59.588: E/AndroidRuntime(18418): FATAL EXCEPTION: main 06-01 07:19:59.588: E/AndroidRuntime(18418): java.lang.IndexOutOfBoundsException: setSpan (10 ... 10) ends beyond length 0 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1016) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:592) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:588) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.Selection.setSelection(Selection.java:76) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.Selection.setSelection(Selection.java:87) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.EditText.setSelection(EditText.java:94) 06-01 07:19:59.588: E/AndroidRuntime(18418): at ti.modules.titanium.ui.widget.TiUIText.onTextChanged(TiUIText.java:285) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.TextView.sendOnTextChanged(TextView.java:7231) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.TextView.handleTextChanged(TextView.java:7290) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:8880) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.TextView.paste(TextView.java:8275) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.TextView.onTextContextMenuItem(TextView.java:8036) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.widget.Editor$ActionPopupWindow.onClick(Editor.java:2862) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.view.View.performClick(View.java:4204) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.view.View$PerformClick.run(View.java:17355) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.os.Handler.handleCallback(Handler.java:725) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.os.Handler.dispatchMessage(Handler.java:92) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.os.Looper.loop(Looper.java:137) 06-01 07:19:59.588: E/AndroidRuntime(18418): at android.app.ActivityThread.main(ActivityThread.java:5041) 06-01 07:19:59.588: E/AndroidRuntime(18418): at java.lang.reflect.Method.invokeNative(Native Method) 06-01 07:19:59.588: E/AndroidRuntime(18418): at java.lang.reflect.Method.invoke(Method.java:511) 06-01 07:19:59.588: E/AndroidRuntime(18418): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 06-01 07:19:59.588: E/AndroidRuntime(18418): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 06-01 07:19:59.588: E/AndroidRuntime(18418): at dalvik.system.NativeStart.main(Native Method)
    via by Davide Cassenti,
  • Crash on long press back button
    via GitHub by madhur
    ,
    • java.lang.IndexOutOfBoundsException: setSpan (10 ... 10) ends beyond length 0 at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1016) at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:592) at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:588) at android.text.Selection.setSelection(Selection.java:76) at android.text.Selection.setSelection(Selection.java:87) at android.widget.EditText.setSelection(EditText.java:94) at ti.modules.titanium.ui.widget.TiUIText.onTextChanged(TiUIText.java:285) at android.widget.TextView.sendOnTextChanged(TextView.java:7231) at android.widget.TextView.handleTextChanged(TextView.java:7290) at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:8880) at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30) at android.widget.TextView.paste(TextView.java:8275) at android.widget.TextView.onTextContextMenuItem(TextView.java:8036) at android.widget.Editor$ActionPopupWindow.onClick(Editor.java:2862) at android.view.View.performClick(View.java:4204) at android.view.View$PerformClick.run(View.java:17355) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5041) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method)

    Users with the same issue

    filpgame
    1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    9 more bugmates