I am getting a NumberFormatException although I have StringUtils.isBlank()
and I also added a check for a non-breakable white space character, as mentioned in below code:
if (isBlank(amtBeforeTax) || amtBeforeTax.matches("^[\\p{Z}]*$")) {
ra.setAmtBeforeTax(BigDecimal.ZERO);
} else {
ra.setAmtBeforeTax(new BigDecimal(amtBeforeTax));
}
Still I am getting a number format exception on the on the above piece of code. I do not have the control over the amtBeforeTax
, It's a stream of data I am getting and just setting it to some other object. I wanted to know what exactly the precussion i will take over here to avoid the exception.