AymanElarian / droidweight

Automatically exported from code.google.com/p/droidweight
0 stars 0 forks source link

NumberFormatException when reading numbers #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Stacktrace found on developer's console. Happened at least 2 times ...

java.lang.NumberFormatException:
at 
org.apache.harmony.luni.util.FloatingPointParser.parseFloat(FloatingPointParser.
java:305)
at java.lang.Float.parseFloat(Float.java:291)
at 
de.delusions.measure.activities.prefs.FloatEditTextPreference.persistString(Floa
tEditTextPreference.java:40)
at android.preference.EditTextPreference.setText(EditTextPreference.java:88)
at 
android.preference.EditTextPreference.onDialogClosed(EditTextPreference.java:142
)
at android.preference.DialogPreference.onDismiss(DialogPreference.java:384)
at android.app.Dialog$ListenersHandler.handleMessage(Dialog.java:1167)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:5127)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)

Original issue reported on code.google.com by yash...@gmail.com on 25 Jun 2011 at 10:02

GoogleCodeExporter commented 9 years ago
I have included handling for the parseFloat to fail.
try { ... } catch (NumberFormatException e { ... }

The method persisting a float property now returns false if the float cannot be 
parsed. This is consistent with the behaviour of EditTextPrference which 
FloatEditTextPreference extends.

I'll commit my change right away.

Original comment by yash...@gmail.com on 11 Jul 2011 at 8:45

GoogleCodeExporter commented 9 years ago
This was long fixed.

Original comment by yash...@gmail.com on 22 Dec 2012 at 8:35