This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Look at the string version of the value before you try parsing it to a Long.
String value = request.getParameter("ccnumber");
Play with entering nothing, entering something and deleting it with backspace, delete with the delete key, any other combination you can think of. I think sometimes you'll find null and sometimes an empty string. At least our web folks always test for both.
Alternatively you might just catch the exception thrown by parseLong for invalid values like embedded spaces or letters or whatever. Try that with those input combinations, too. [ April 19, 2005: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Mar 31, 2005
Ah yes, that's brilliant, I don't know why I didn't think of that before. Thanks so much!