|Summary:||[PATCH] evaluateInCell fails if the formula was previously invalid|
|Product:||POI||Reporter:||Robert Longson <robert_longson>|
|Component:||HSSF||Assignee:||POI Developers List <dev>|
Description Robert Longson 2009-01-05 08:01:08 UTC
Created attachment 23086 [details] patch a) Create a formula that is invalid e.g. put XXX in A1 and =A1+1 in B1. b) Change the value in A1 to 2.5 c) Call HSSFFormulaEvaluator.evaluateInCell on B1 Actual Result: java.lang.IllegalStateException: Cannot get a numeric value from a error formula cell Expected Result: B1 contains 3.5 POI 3.1 did not have this problem but POI 3.2 and all newer versions including the current trunk do.
Comment 3 Josh Micich 2009-01-05 13:12:20 UTC
Thanks for the patch. There is some ambiguity in original design as to whether setCellType() should be called before or after setCellValue(). The methods overlap in behaviour: setCellValue() may change the cell type, and setCellType() converts the old cell value to the new type and sets the new value in the cell. The new ordering of these calls (setCellValue before setCellType) actually causes other junits to fail, but your fix still seems correct to me. Three other related bugs were found and fixed, and junits added for all of them. svn r731715