You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Dmitri Blinov <db...@bellwood.ru> on 2010/03/07 19:50:41 UTC

Error in formula evaluation

Hello all!

I have found an error in POI when evaluating formulas. Unfortunately I 
haven't got time to package all necessary diffs to submit a patch,
to be honest I'm not even familiar with JUnit testing framework, but I 
think someone in community could pay his attention to this error and
include the fix in source tree by chance:

In Excel some logical functions allow empty operands, so that OR(TRUE;) 
or AND(FALSE;) are both valid constructions.
     At the time POI throws the following exception on this:

java.lang.RuntimeException: Unexpected eval 
(org.apache.poi.hssf.record.formula.eval.MissingArgEval):java.lang.RuntimeException: 
Unexpected eval (org.apache.poi.hssf.record.formula.eval.MissingArgEval)

     to get the things right we need to add the following code to 
org.apache.poi.hssf.record.formula.eval.OperandResolver.coerceValueToBoolean

                 if (ve instanceof MissingArgEval) {
                         return Boolean.FALSE;
                 }

I hope this could save a day for someone.

Best regards,
Dmitri


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org