assertEquals(CellType.ERROR, a1.getCachedFormulaResultType());
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
CellValue cv1 = evaluator.evaluate(a1);
- //this next line should probably return CellType.ERROR
- assertEquals(CellType.NUMERIC, cv1.getCellType());
+ assertEquals(CellType.ERROR, cv1.getCellType());
+ assertEquals(ErrorEval.VALUE_INVALID.getErrorCode(), cv1.getErrorValue());
}
}
}
\ No newline at end of file
import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.util.StringUtil;
import java.time.DateTimeException;
return e.getErrorEval();
}
String strText = OperandResolver.coerceValueToString(veText);
+ if (StringUtil.isBlank(strText)) {
+ return ErrorEval.VALUE_INVALID;
+ }
Double result = convertTextToNumber(strText);
if (result == null) result = parseDateTime(strText);
if (result == null) {
confirmValueError(",300");
confirmValueError("0.233,4");
confirmValueError("1e2.5");
+ confirmValueError("");
}
}