Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protect.card_locker.Utils.parseBalance: java.lang.NumberFormatException #1506

Closed
TheLastProject opened this issue Sep 12, 2023 · 5 comments · Fixed by #1838
Closed

protect.card_locker.Utils.parseBalance: java.lang.NumberFormatException #1506

TheLastProject opened this issue Sep 12, 2023 · 5 comments · Fixed by #1838
Assignees
Labels
common: uncommon Most users are unlikely to come across this or unexpected workflow good first issue Good for newcomers severity: tolerable Low/no impact on users type: bug Something isn't working

Comments

@TheLastProject
Copy link
Member

Found in Google Play Console

Catima 2.25.3 on samsung a3core (Galaxy A03 Core) running Android 11 (SDK 30)

Not sure how they managed to set that input string but okay.

Exception java.lang.NumberFormatException: For input string: "Infinity"
  at java.lang.Long.parseLong (Long.java:594)
  at java.lang.Long.parseLong (Long.java:636)
  at java.math.BigDecimal.<init> (BigDecimal.java:344)
  at java.math.BigDecimal.<init> (BigDecimal.java:425)
  at protect.card_locker.Utils.parseBalance (Utils.java:309)
  at protect.card_locker.LoyaltyCardEditActivity$3.onTextChanged (LoyaltyCardEditActivity.java:410)
  at android.widget.TextView.sendOnTextChanged (TextView.java:10769)
  at android.widget.TextView.handleTextChanged (TextView.java:10876)
  at android.widget.TextView$ChangeWatcher.onTextChanged (TextView.java:14328)
  at android.text.SpannableStringBuilder.sendTextChanged (SpannableStringBuilder.java:1267)
  at android.text.SpannableStringBuilder.replace (SpannableStringBuilder.java:576)
  at androidx.emoji2.text.SpannableBuilder.replace (SpannableBuilder.java:315)
  at android.text.SpannableStringBuilder.replace (SpannableStringBuilder.java:507)
  at androidx.emoji2.text.SpannableBuilder.replace (SpannableBuilder.java:305)
  at androidx.emoji2.text.SpannableBuilder.replace (SpannableBuilder.java:49)
  at android.view.inputmethod.BaseInputConnection.replaceText (BaseInputConnection.java:861)
  at android.view.inputmethod.BaseInputConnection.commitText (BaseInputConnection.java:197)
  at com.android.internal.widget.EditableInputConnection.commitText (EditableInputConnection.java:177)
  at android.view.inputmethod.InputConnectionWrapper.commitText (InputConnectionWrapper.java:169)
  at com.android.internal.view.IInputConnectionWrapper.executeMessage (IInputConnectionWrapper.java:345)
  at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage (IInputConnectionWrapper.java:93)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:223)
  at android.app.ActivityThread.main (ActivityThread.java:7815)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:593)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1094)
@TheLastProject TheLastProject added type: bug Something isn't working severity: tolerable Low/no impact on users common: uncommon Most users are unlikely to come across this or unexpected workflow labels Sep 12, 2023
@TheLastProject
Copy link
Member Author

I get a similar crash on my FP3 (Android 13, L4mG) if I just enter too many 9s:

FATAL EXCEPTION: main
Process: me.hackerchick.catima, PID: 6945
java.lang.NumberFormatException: Character I is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
	at java.math.BigDecimal.<init>(BigDecimal.java:518)
	at java.math.BigDecimal.<init>(BigDecimal.java:401)
	at java.math.BigDecimal.<init>(BigDecimal.java:834)
	at protect.card_locker.Utils.parseBalance(Utils.java:309)
	at protect.card_locker.LoyaltyCardEditActivity$3.onTextChanged(LoyaltyCardEditActivity.java:410)
	at android.widget.TextView.sendOnTextChanged(TextView.java:11065)
	at android.widget.TextView.handleTextChanged(TextView.java:11180)
	at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:14168)
	at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:1268)
	at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:577)
	at androidx.emoji2.text.SpannableBuilder.replace(SpannableBuilder.java:315)
	at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:508)
	at androidx.emoji2.text.SpannableBuilder.replace(SpannableBuilder.java:305)
	at androidx.emoji2.text.SpannableBuilder.replace(SpannableBuilder.java:49)
	at android.widget.TextViewOnReceiveContentListener.replaceSelection(TextViewOnReceiveContentListener.java:123)
	at android.widget.TextViewOnReceiveContentListener.onReceiveContent(TextViewOnReceiveContentListener.java:105)
	at android.widget.TextView.onReceiveContent(TextView.java:14249)
	at android.view.View.performReceiveContent(View.java:9285)
	at android.widget.TextView.paste(TextView.java:13394)
	at android.widget.TextView.onTextContextMenuItem(TextView.java:12903)
	at androidx.appcompat.widget.AppCompatEditText.onTextContextMenuItem(AppCompatEditText.java:367)
	at android.widget.Editor$TextActionModeCallback.onActionItemClicked(Editor.java:4517)
	at com.android.internal.policy.DecorView$ActionModeCallback2Wrapper.onActionItemClicked(DecorView.java:2741)
	at com.android.internal.view.FloatingActionMode$3.onMenuItemSelected(FloatingActionMode.java:97)
	at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:788)
	at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
	at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:935)
	at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:925)
	at com.android.internal.view.FloatingActionMode.lambda$setFloatingToolbar$0$com-android-internal-view-FloatingActionMode(FloatingActionMode.java:122)
	at com.android.internal.view.FloatingActionMode$$ExternalSyntheticLambda0.onMenuItemClick(Unknown Source:2)
	at com.android.internal.widget.floatingtoolbar.LocalFloatingToolbarPopup$2.onClick(LocalFloatingToolbarPopup.java:177)
	at android.view.View.performClick(View.java:7542)
	at android.view.View.performClickInternal(View.java:7519)
	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
	at android.view.View$PerformClick.run(View.java:29476)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7924)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

@obfusk obfusk mentioned this issue Oct 15, 2023
49 tasks
@TheLastProject TheLastProject added the good first issue Good for newcomers label Mar 10, 2024
@simosathan9
Copy link
Contributor

simosathan9 commented Apr 15, 2024

Hello,

I'm reaching out as a first-time contributor to the project, eager to contribute and assist in resolving any issues that may arise.

During my exploration of the system, I observed that when I add many 9s to the balance field the system does not crash as mentioned in your comment but they are rounded to 10s. For example, when I input "999999999999999", I see the balance displayed as "1000000000000000". This behavior seems unexpected to me. Is it supposed to happen or indeed there is a problem ?

@TheLastProject
Copy link
Member Author

Hmm, interesting, I see putting the number 9 in 19 times in the Balance field translates it to 10.000.000.000.000.000.000 to me too. It seems like a rounding thing but that surprises me as I thought BigDecimal was explicitly supposed to not round :/ Or maybe it's the Currency format call, no clue :/ It's not expected to me at least, but I have no clue what causes that or how to possibly fix it without breaking anything else.

The crash itself needs way more 9s, I just keep using copy-paste to double it and when I doubled from 200 to 400 the crash happened. So pasting this into a Catima balance field should crash it:

9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

@simosathan9
Copy link
Contributor

Yes I see the problem it happened to me as well when I inserted so many 9s. I would like to help resolve these issues if possible. Could I get assigned to try find what causes these issues and fix them please?

@TheLastProject
Copy link
Member Author

Go for it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common: uncommon Most users are unlikely to come across this or unexpected workflow good first issue Good for newcomers severity: tolerable Low/no impact on users type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants