Hello, Not sure about the version, I got latest stuff from CVS. http://svn.apache.org/repos/asf/poi/trunk if I try to calculate the following: "DATE(,1,1)" I'll have an exception. java.util.EmptyStackException at java.util.Stack.peek(Stack.java:79) at java.util.Stack.pop(Stack.java:61) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.internalEvaluate(HSSFFormulaEvaluator.java:326) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluate(HSSFFormulaEvaluator.java:192) at org.apache.poi.hssf.record.formula.functions.DateTest.testValid(DateTest.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Is this one still a problem, or has it been fixed by the formula parser updates?
This does still happen, with r701302. Some earlier versions failed on parse-phase, thus "hiding" this bug. Easy to reproduce: Excel having "=IF(B1=1,5,)" in cell A1 Evaluate it: cell = sheet.getRow(0).getCell(0); if(cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA) { evaluator.evaluateFormulaCell(cell); } Get exception: java.util.EmptyStackException at java.util.Stack.peek(Stack.java:85) at java.util.Stack.pop(Stack.java:67) at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:300) at org.apache.poi.ss.formula.WorkbookEvaluator.internalEvaluate(WorkbookEvaluator.java:213) at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:179) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCellValue(HSSFFormulaEvaluator.java:272) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCell(HSSFFormulaEvaluator.java:165)
Fixed in svn r702231 You're right. POI was fixed a little while back to *parse* missing args properly, but the formula evaluator has never been capable of handling them. The new implementation assumes that missing arguments are equivalent to references to blank cells. The only example found (so far) that needed special attention was the count functions (COUNT and COUNTA) which really *do* count missing args (but not blank cells).