Bug 46053

Summary: Evaluation cache dependency analysis broken when changing blank values
Product: POI Reporter: Josh Micich <josh>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Josh Micich 2008-10-21 14:15:13 UTC
The following code demonstrates the problem:

HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Sheet1");
HSSFRow row = sheet.createRow(0);
HSSFCell cellA1 = row.createCell(0);
HSSFCell cellB1 = row.createCell(1);
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);

cellA1.setCellFormula("B1+2.2");
cellB1.setCellValue(1.5);

fe.notifyUpdateCell(cellA1);
fe.notifyUpdateCell(cellB1);

CellValue cv;
cv = fe.evaluate(cellA1);
assertEquals(3.7, cv.getNumberValue(), 0.0);

cellB1.setCellType(HSSFCell.CELL_TYPE_BLANK);
fe.notifyUpdateCell(cellB1);
cv = fe.evaluate(cellA1);
assertEquals(2.2, cv.getNumberValue(), 0.0);

cellB1.setCellValue(0.4);
fe.notifyUpdateCell(cellB1);
cv = fe.evaluate(cellA1);
if (cv.getNumberValue() == 2.2) {
	throw new AssertionFailedError("Error in evaluation dependency (cached value not reset)");
}
assertEquals(2.6, cv.getNumberValue(), 0.0);
Comment 1 Josh Micich 2008-10-21 14:29:04 UTC
Fixed in svn r706722
Comment 2 Josh Micich 2008-11-03 11:36:02 UTC
(In reply to comment #1)
> Fixed in svn r706722
> 

oops - actually it was svn r706772