My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 95: Validation on numeric textfields stops long numbers being allowed
2 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Jan 2011


 
Reported by gareth.m...@gmail.com, Jan 18, 2011
What steps will reproduce the problem?
1. Set up a textfield that can handle 10 numbers
2. Try to enter ten 9s, thats 999999999
3. Observe how it will only allow 9 and not 10 

What is the expected output? What do you see instead?

Expected output is that the textfield will allow ten number 9 digits and not only 9.

What version of the product are you using? On what operating system?
Microemu revision 2450 on Win7

Please provide any additional information below.

The fix is very simple, in:
org.microemu.device.InputMethod.java in the method validate() around line 110 swap Integer.parseInt(text); for Long.parseLong(text);

this allows large numbers to parse and retains functionality. 

fixed code is:

	case TextField.NUMERIC :
              if (text != null && text.length() > 0 && !text.equals("-")) {
                    try { 
                        //Integer.parseInt(text); 
			Long.parseLong(text);// parse a long since nfe can be thrown with some ints!
                    } catch (NumberFormatException e) { 
						
                        return false;
                    }
                }
                break; 

Jan 18, 2011
Project Member #1 bar...@gmail.com
(No comment was entered for this change.)
Status: Accepted
Labels: Milestone-3.0
Jan 25, 2011
Project Member #2 bar...@gmail.com
(No comment was entered for this change.)
Status: Fixed

Powered by Google Project Hosting