Skip to content

On prod: java.lang.StringIndexOutOfBoundsException #56

Open
ilyaklyukin opened this issue Nov 2, 2020 · 2 comments
Open

On prod: java.lang.StringIndexOutOfBoundsException #56

ilyaklyukin opened this issue Nov 2, 2020 · 2 comments

Comments

@ilyaklyukin
Copy link

implementation 'ru.tinkoff.decoro:decoro:1.5.0'

We see multiple crashes in Firebase crashlytics:

Fatal Exception: java.lang.StringIndexOutOfBoundsException: length=0; index=8
at java.lang.String.substring(String.java:2060)
at ru.tinkoff.decoro.watchers.FormatWatcher.afterTextChanged(FormatWatcher.java:255)
at android.widget.TextView.sendAfterTextChanged(TextView.java:11664)
at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:14910)
at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:1277)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:577)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:507)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:37)
at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:849)
at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:618)
at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:393)
at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:89)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7814)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)

@MairwunNx
Copy link

@ilyaklyukin you must write unit tests (with attachments passed values to afterTextChanged) for better investigating this issue.

Without it investigating this issue impossible.

@elephant16
Copy link

The same issue.
Appears on some devices if inputType in EditText is set.
About 64 out of 2000 users had this error.

This is very similar to the following problem, see the link
https://github.com/RedMadRobot/input-mask-android#inputmask-vs-androidinputtype-and-indexoutofboundsexception

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants