decoro icon indicating copy to clipboard operation
decoro copied to clipboard

On prod: java.lang.StringIndexOutOfBoundsException

Open ilyaklyukin opened this issue 4 years ago • 2 comments

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)

ilyaklyukin avatar Nov 02 '20 14:11 ilyaklyukin

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

Without it investigating this issue impossible.

MairwunNx avatar Feb 20 '21 11:02 MairwunNx

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

elephant16 avatar Dec 07 '21 10:12 elephant16