Home » Java » Number format exception for decimal number when given double

Number format exception for decimal number when given double

Posted by: admin October 29, 2018 Leave a comment

Questions:

When I run the following script to check inputQty greater than AvailQty I am getting the following “java.lang.NumberFormatException: For input string: “97,045.1193” ” this error occurs if availableQty is a decimal number. The value is delivered from a database, can you please correct me where I am wrong?

   double AvailQty = Double.valueOf(INV.AVAILQTY.getValue());
   double inputQty = Double.valueOf(XX_IGL_QTY.getValue());
   if(inputQty > AvailQty){
    session.setStatusMessage("Not Enough Quantity");
    //Abort operation
    throw new AbortHandlerException();
  }

Thanks

Answers: