java.lang.IndexOutOfBoundsException: setSpan (10 ... 10) ends beyond length 0

Appcelerator JIRA | Davide Cassenti | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    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)

    Appcelerator JIRA | 4 years ago | Davide Cassenti
    java.lang.IndexOutOfBoundsException: setSpan (10 ... 10) ends beyond length 0
  2. 0

    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)

    Appcelerator JIRA | 4 years ago | Davide Cassenti
    java.lang.IndexOutOfBoundsException: setSpan (10 ... 10) ends beyond length 0
  3. 0

    Crash on long press back button

    GitHub | 3 years ago | madhur
    java.lang.IndexOutOfBoundsException: setSpan (5 ... 5) ends beyond length 4
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Random crash when deleting a token

    GitHub | 3 years ago | anoopsankar
    java.lang.IndexOutOfBoundsException: setSpan (23 ... 23) ends beyond length 22
  6. 0

    红米2A打不开热点设置_BUG反馈_MIUI论坛

    miui.com | 2 years ago
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.settings/com.android.settings.SubSettings}: java.lang.IndexOutOfBoundsException: setSpan (12 ... 12) ends beyond length 0

  1. filpgame 1 times, last 3 months ago
3 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IndexOutOfBoundsException

    setSpan (10 ... 10) ends beyond length 0

    at android.text.SpannableStringBuilder.checkRange()
  2. Android Platform
    EditText.setSelection
    1. android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1016)
    2. android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:592)
    3. android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:588)
    4. android.text.Selection.setSelection(Selection.java:76)
    5. android.text.Selection.setSelection(Selection.java:87)
    6. android.widget.EditText.setSelection(EditText.java:94)
    6 frames
  3. ti.modules.titanium
    TiUIText.onTextChanged
    1. ti.modules.titanium.ui.widget.TiUIText.onTextChanged(TiUIText.java:285)
    1 frame
  4. Android Platform
    ActivityThread.main
    1. android.widget.TextView.sendOnTextChanged(TextView.java:7231)
    2. android.widget.TextView.handleTextChanged(TextView.java:7290)
    3. android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:8880)
    4. android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962)
    5. android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496)
    6. android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435)
    7. android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30)
    8. android.widget.TextView.paste(TextView.java:8275)
    9. android.widget.TextView.onTextContextMenuItem(TextView.java:8036)
    10. android.widget.Editor$ActionPopupWindow.onClick(Editor.java:2862)
    11. android.view.View.performClick(View.java:4204)
    12. android.view.View$PerformClick.run(View.java:17355)
    13. android.os.Handler.handleCallback(Handler.java:725)
    14. android.os.Handler.dispatchMessage(Handler.java:92)
    15. android.os.Looper.loop(Looper.java:137)
    16. android.app.ActivityThread.main(ActivityThread.java:5041)
    16 frames
  5. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:511)
    2 frames
  6. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    2 frames
  7. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(Native Method)
    1 frame