tlaukkanen / mobile-trail-explorer

Automatically exported from code.google.com/p/mobile-trail-explorer
2 stars 0 forks source link

Input validation for numbers #167

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Nokia 6230i phone or emulator

* Open calculate time
* enter something not a number, f.ex '0.00a' 

expects: Graceful error message

current behavior: Application crash with "Application Error"
(NumberFormatException)

Can't remember right now, but I get a feeling that I've seen this elsewhere
also.

Original issue reported on code.google.com by ttyri...@gmail.com on 9 Mar 2009 at 10:32

GoogleCodeExporter commented 9 years ago
I changed text field type to decimal.

Original comment by tlaukka...@gmail.com on 17 Mar 2009 at 8:08

GoogleCodeExporter commented 9 years ago
I'm pretty sure it's the 'a' that caused the exception - and that the bug is: 
not
catching the exception

Original comment by ttyri...@gmail.com on 18 Mar 2009 at 11:56

GoogleCodeExporter commented 9 years ago
I meant that I changed the TextField constraint to DECIMAL so that it only 
accepts
decimal numbers to be entered in that field. It doesn't let you enter 
characters like
'a' in the field.

Original comment by tlaukka...@gmail.com on 18 Mar 2009 at 2:27

GoogleCodeExporter commented 9 years ago
Here's the fixed version of the TextField construction:
distanceField = new
TextField(LocaleManager.getMessage("calculate_time_form_distance"), "", 32,
TextField.DECIMAL);

Original comment by tlaukka...@gmail.com on 18 Mar 2009 at 4:14