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

NumberFormatException #39

Closed
tianxiaogu opened this Issue Nov 2, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@tianxiaogu

tianxiaogu commented Nov 2, 2017

When parsing Siginificant digits in result, a NumberFormatException may be triggered if the input number is very large.

// CRASH: com.mkulesh.micromath.plus (pid 11486) (elapsed nanos: 5755378442858)
// Short Msg: java.lang.NumberFormatException
// Long Msg: java.lang.NumberFormatException: Invalid int: "1274375155085100044673746644154457"
// Build Label: Android/sdk_google_phone_x86/generic_x86:6.0/MASTER/4088240:userdebug/test-keys
// Build Changelist: 4088240
// Build Time: 1497047463000
// java.lang.NumberFormatException: Invalid int: "1274375155085100044673746644154457"
// 	at java.lang.Integer.invalidInt(Integer.java:138)
// 	at java.lang.Integer.parse(Integer.java:413)
// 	at java.lang.Integer.parseInt(Integer.java:367)
// 	at java.lang.Integer.parseInt(Integer.java:334)
// 	at java.lang.Integer.valueOf(Integer.java:525)
// 	at com.mkulesh.micromath.widgets.HorizontalNumberPicker.onClick(HorizontalNumberPicker.java:111)
// 	at android.view.View.performClick(View.java:5198)
// 	at android.view.View$PerformClick.run(View.java:21147)
// 	at android.os.Handler.handleCallback(Handler.java:739)
// 	at android.os.Handler.dispatchMessage(Handler.java:95)
// 	at android.os.Looper.loop(Looper.java:148)
// 	at android.app.ActivityThread.main(ActivityThread.java:5417)
// 	at java.lang.reflect.Method.invoke(Native Method)
// 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
// 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
// 

How to repeat:

  • Start app
  • Open "Document setting" dialog
  • In the field "Significant digits in result", put123456789012.
  • Press "+" button on the right of this field
    Bad: crash is observed
    Desired: field content is set to a maximum allowed value for this element

@mkulesh mkulesh self-assigned this Nov 3, 2017

@mkulesh mkulesh added this to the In work milestone Nov 3, 2017

@mkulesh

This comment has been minimized.

Owner

mkulesh commented Nov 3, 2017

thanks, I will fix it

mkulesh added a commit that referenced this issue Nov 7, 2017

@mkulesh mkulesh modified the milestones: In work, Implemented Nov 7, 2017

@mkulesh

This comment has been minimized.

Owner

mkulesh commented Nov 7, 2017

Hi @tianxiaogu, I fixed this crash. Please test and close the issue if it works now

@mkulesh mkulesh added the bug label Nov 7, 2017

@tianxiaogu

This comment has been minimized.

tianxiaogu commented Nov 7, 2017

Hi @mkulesh , thank you for your patch. Unfortunately, the defect is not fully fixed. I think you probably also need to include a try-catch block in method getValue of class HorizontalNumberPicker.

mkulesh added a commit that referenced this issue Nov 9, 2017

@mkulesh

This comment has been minimized.

Owner

mkulesh commented Nov 9, 2017

Hi @tianxiaogu, thank you for pointing additional case. I fixed it and believe that all cases are covered now.

@mkulesh

This comment has been minimized.

Owner

mkulesh commented Nov 20, 2017

Implemented in v2.15.5

@mkulesh mkulesh closed this Nov 20, 2017

mkulesh added a commit that referenced this issue Nov 27, 2017

#39: NumberFormatException: fixed
(cherry picked from commit ea9be06)

mkulesh added a commit that referenced this issue Nov 27, 2017

#39: NumberFormatException: fixed
(cherry picked from commit 7f1f669)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment