case ERROR:
byte errorValue = (byte) ((FormulaRecordAggregate)_record).getFormulaRecord().getCachedErrorValue();
_record = new BoolErrRecord();
- ((BoolErrRecord)_record).setValue(errorValue);
+ try {
+ ((BoolErrRecord)_record).setValue(errorValue);
+ } catch (IllegalArgumentException ise) {
+ ((BoolErrRecord)_record).setValue((byte) ErrorEval.REF_INVALID.getErrorCode());
+ }
_cellType = CellType.ERROR;
break;
default:
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellType;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.io.IOException;
class TestFormulaEval {
- @Disabled("https://bz.apache.org/bugzilla/show_bug.cgi?id=65939")
@Test
void testCircularRef() throws IOException {
try (HSSFWorkbook wb = new HSSFWorkbook()) {
// the following assert should probably be NUMERIC not ERROR (from testing in Excel itself)
assertEquals(CellType.ERROR, formulaEvaluator.evaluateFormulaCell(cell));
- cell.setCellFormula(null); //this line fails
+ cell.setCellFormula(null);
formulaEvaluator.notifyUpdateCell(cell);
+ //the following assert should probably be BLANK not ERROR
+ assertEquals(CellType.ERROR, cell.getCellType());
}
}
}