1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

NumberFormatException maybe yes maybe no

Discussion in 'Java' started by LeoPelo, Mar 26, 2009.

  1. LeoPelo

    LeoPelo New Member

    I have to work on a test machine and when my work is complete and tested, I have to put it online for customers.

    On these two machines my code doesn't work in different ways!

    This part is the problem:

    public void setQntaRiduAsDecimalQuantityString(String qntaRidu) {
    try{
    Double pippo=new Double(qntaRidu.replace(',','.'));
    }
    catch(NumberFormatException x)
    {...}

    On test machine i have String qntaRidu = 42,123 (with comma).
    All goes ok and pippo gets 42.123

    On "Online" machine the same code, and same value in qntaRidu , cast a NumberFormatException.

    In java, is number format customizable ? (for example in Oracle you can localize your machine, so you can choose to have comma as decimal separator instead of dot.)

    Thanks for help (i work with oc4j 10.1.3.3)
     

Share This Page