You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When loading an Excel file, an error occurs with the message: "Character is neither a decimal digit number, decimal point, nor "e" notation exponential mark." This issue appears to be caused by inadequate exception handling in the CellTagHandler class, specifically in rows 85-95.
your code snippet: case NUMBER:
case EMPTY:
if (StringUtils.isEmpty(tempDataString)) {
tempCellData.setType(CellDataTypeEnum.EMPTY);
break;
}
tempCellData.setType(CellDataTypeEnum.NUMBER);
tempCellData.setOriginalNumberValue(new BigDecimal(tempDataString));
tempCellData.setNumberValue(
tempCellData.getOriginalNumberValue().round(EasyExcelConstants.EXCEL_MATH_CONTEXT));
break;
Expected Behavior
The application should handle cells with trailing spaces or non-numeric characters gracefully, either by trimming the value or providing a more informative error message.
Actual Behavior
The application throws an exception with the message: "Character is neither a decimal digit number, decimal point, nor "e" notation exponential mark."
Proposed Solution
Implement exception handling for BigDecimal creation in the CellTagHandler class. Consider the following approaches:
Trim whitespace from cell values before attempting to create a BigDecimal.
Implement a try-catch block to handle NumberFormatException and provide a more user-friendly error message.
Add validation to check for non-numeric characters before BigDecimal conversion.
The text was updated successfully, but these errors were encountered:
When loading an Excel file, an error occurs with the message: "Character is neither a decimal digit number, decimal point, nor "e" notation exponential mark." This issue appears to be caused by inadequate exception handling in the CellTagHandler class, specifically in rows 85-95.
your code snippet: case NUMBER:
case EMPTY:
if (StringUtils.isEmpty(tempDataString)) {
tempCellData.setType(CellDataTypeEnum.EMPTY);
break;
}
tempCellData.setType(CellDataTypeEnum.NUMBER);
tempCellData.setOriginalNumberValue(new BigDecimal(tempDataString));
tempCellData.setNumberValue(
tempCellData.getOriginalNumberValue().round(EasyExcelConstants.EXCEL_MATH_CONTEXT));
break;
Expected Behavior
The application should handle cells with trailing spaces or non-numeric characters gracefully, either by trimming the value or providing a more informative error message.
Actual Behavior
The application throws an exception with the message: "Character is neither a decimal digit number, decimal point, nor "e" notation exponential mark."
Proposed Solution
Implement exception handling for BigDecimal creation in the CellTagHandler class. Consider the following approaches:
Trim whitespace from cell values before attempting to create a BigDecimal.
Implement a try-catch block to handle NumberFormatException and provide a more user-friendly error message.
Add validation to check for non-numeric characters before BigDecimal conversion.
The text was updated successfully, but these errors were encountered: