GerardDellemann commented on a change in pull request #234: MM-82 Detect Column 
Types
URL: https://github.com/apache/metamodel/pull/234#discussion_r356011213
 
 

 ##########
 File path: excel/src/main/java/org/apache/metamodel/excel/ExcelUtils.java
 ##########
 @@ -189,40 +185,61 @@ public static String getCellValue(Workbook wb, Cell 
cell) {
             result = Boolean.toString(cell.getBooleanCellValue());
             break;
         case ERROR:
-            String errorResult;
-            try {
-                byte errorCode = cell.getErrorCellValue();
-                FormulaError formulaError = FormulaError.forInt(errorCode);
-                errorResult = formulaError.getString();
-            } catch (RuntimeException e) {
-                logger.debug("Getting error code for {} failed!: {}", 
cellCoordinate, e.getMessage());
-                if (cell instanceof XSSFCell) {
-                    // hack to get error string, which is available
-                    String value = ((XSSFCell) cell).getErrorCellString();
-                    errorResult = value;
-                } else {
-                    logger.error("Couldn't handle unexpected error scenario in 
cell: " + cellCoordinate, e);
-                    throw e;
-                }
-            }
-            result = errorResult;
+            result = (String) getErrorResult(cell);
 
 Review comment:
   correct

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to