package org.apache.poi.hssf.record.formula.functions;
+import org.apache.poi.hssf.record.formula.eval.BlankEval;
import org.apache.poi.hssf.record.formula.eval.ErrorEval;
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
+import org.apache.poi.hssf.record.formula.eval.MissingArgEval;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
if (ix < 1 || ix >= args.length) {
return ErrorEval.VALUE_INVALID;
}
- return OperandResolver.getSingleValue(args[ix], srcRowIndex, srcColumnIndex);
+ ValueEval result = OperandResolver.getSingleValue(args[ix], srcRowIndex, srcColumnIndex);
+ if (result == MissingArgEval.instance) {
+ return BlankEval.INSTANCE;
+ }
+ return result;
} catch (EvaluationException e) {
return e.getErrorEval();
}
package org.apache.poi.hssf.record.formula.functions;
+import org.apache.poi.hssf.record.formula.eval.BlankEval;
import org.apache.poi.hssf.record.formula.eval.BoolEval;
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
+import org.apache.poi.hssf.record.formula.eval.MissingArgEval;
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
import org.apache.poi.hssf.record.formula.eval.ValueEval;
} catch (EvaluationException e) {
return e.getErrorEval();
}
- return b ? arg1 : BoolEval.FALSE;
+ if (b) {
+ if (arg1 == MissingArgEval.instance) {
+ return BlankEval.INSTANCE;
+ }
+ return arg1;
+ }
+ return BoolEval.FALSE;
}
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1,
} catch (EvaluationException e) {
return e.getErrorEval();
}
- return b ? arg1 : arg2;
+ if (b) {
+ if (arg1 == MissingArgEval.instance) {
+ return BlankEval.INSTANCE;
+ }
+ return arg1;
+ }
+ if (arg2 == MissingArgEval.instance) {
+ return BlankEval.INSTANCE;
+ }
+ return arg2;
}
public static boolean evaluateFirstArg(ValueEval arg, int srcCellRow, int srcCellCol)
}
// logDebug("invoke " + operation + " (nAgs=" + numops + ")");
opResult = OperationEvaluatorFactory.evaluate(optg, ops, ec);
- if (opResult == MissingArgEval.instance) {
- opResult = BlankEval.INSTANCE;
- }
} else {
opResult = getEvalForPtg(ptg, ec);
}