From: Anneli <an...@us...> - 2005-01-18 15:32:19
|
Update of /cvsroot/redpos/RedPOS/src/org/redpos/client/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30990/src/org/redpos/client/ui Modified Files: POSDashboardProductPriceReceiver.java Log Message: Better handling of NumberFormatException Index: POSDashboardProductPriceReceiver.java =================================================================== RCS file: /cvsroot/redpos/RedPOS/src/org/redpos/client/ui/POSDashboardProductPriceReceiver.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** POSDashboardProductPriceReceiver.java 23 Nov 2004 16:02:09 -0000 1.1 --- POSDashboardProductPriceReceiver.java 18 Jan 2005 15:31:58 -0000 1.2 *************** *** 255,273 **** if(amountString != null && amountString.length() > 0) { // convert input to double, this throws NumberFormatException // which is handled in the catch clause below // replace ',' with '.' in string amountString = amountString.replace(',', '.'); - Double amountDouble = Double.valueOf(amountString); - - if(amountDouble.doubleValue() >= 10000) - { - setFocus(); - return; - } - - Amount amount = new Amount(amountDouble.doubleValue()); try { // call POS engine service // --- 255,275 ---- if(amountString != null && amountString.length() > 0) { + // convert input to double, this throws NumberFormatException // which is handled in the catch clause below // replace ',' with '.' in string amountString = amountString.replace(',', '.'); try { + Double amountDouble = Double.valueOf(amountString); + + if(amountDouble.doubleValue() >= 10000) + { + setFocus(); + return; + } + + Amount amount = new Amount(amountDouble.doubleValue()); + // call POS engine service // |