https://issues.apache.org/bugzilla/show_bug.cgi?id=57196

            Bug ID: 57196
           Summary: When Re-calculating all formulas in a Workbook which
                    include "HEX2DEC" function get unexpected exception
           Product: POI
           Version: 3.10-FINAL
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: jz...@talend.com

Created attachment 32200
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32200&action=edit
test file

Please see the attache file[toto.xlsx] and code:
InputStream inp = new FileInputStream("E:/test_file/toto.xlsx");
Workbook wb = WorkbookFactory.create(inp);
Sheet sheet = wb.getSheet("Feuil1");
Row mod=sheet.getRow(1);
mod.getCell(1).setCellValue(3);
HSSFFormulaEvaluator.evaluateAllFormulaCells(wb);
ileOutputStream fileOutput = new FileOutputStream("E:/test_file/toto.xlsx");
wb.write(fileOutput);
fileOutput.close();

1.toto.xlsx include "HEX2DEC" function
2.We change one cell value of the sheet.
3.call HSSFFormulaEvaluator.evaluateAllFormulaCells(wb) to Re-calculating the
cell value
When run the code we got the exception:
java.lang.IllegalArgumentException: Unexpected eval class
(org.apache.poi.ss.formula.LazyRefEval)
    at
org.apache.poi.ss.formula.eval.OperandResolver.coerceValueToString(OperandResolver.java:275)
    at org.apache.poi.ss.formula.functions.Hex2Dec.evaluate(Hex2Dec.java:46)
    at org.apache.poi.ss.formula.functions.Hex2Dec.evaluate(Hex2Dec.java:58)
    at
org.apache.poi.ss.formula.UserDefinedFunction.evaluate(UserDefinedFunction.java:64)
    at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:129)
    at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:525)
    at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:288)
    at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:230)
    at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCellValue(XSSFFormulaEvaluator.java:264)
    at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCell(XSSFFormulaEvaluator.java:151)
    at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateAllFormulaCells(HSSFFormulaEvaluator.java:324)
    at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateAllFormulaCells(HSSFFormulaEvaluator.java:315)
    at org.talend.test.TestPOI.main(TestPOI.java:49)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to