Handle NumberFormatException in parse number when import format

This commit is contained in:
Elaine Tan 2013-11-21 14:07:57 +08:00
parent b6f3d8ac6a
commit feb76efeeb
1 changed files with 13 additions and 1 deletions

View File

@ -485,7 +485,19 @@ public final class ImpFormatRow
if (sb.length() == 0)
return "0";
BigDecimal bd = new BigDecimal(sb.toString());
BigDecimal bd = null;
try
{
bd = new BigDecimal(sb.toString());
}
catch (NumberFormatException pe)
{
log.log(Level.SEVERE, "ImpFormatRow.parseNumber - " + info, pe);
}
if (bd == null)
bd = BigDecimal.ZERO;
if (m_divideBy100) // assumed two decimal scale
bd = bd.divide(Env.ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP);
return bd.toString();