From ff3dbad0476ac807e894129c91028b5130c862a3 Mon Sep 17 00:00:00 2001 From: Josh Micich Date: Fri, 5 Sep 2008 20:43:37 +0000 Subject: [PATCH] reverted changes accidentally submitted with r692538 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@692541 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hssf/record/formula/functions/Index.java | 12 +----------- .../hssf/record/formula/functions/LookupUtils.java | 5 +---- .../poi/hssf/record/formula/functions/Vlookup.java | 11 +---------- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Index.java b/src/java/org/apache/poi/hssf/record/formula/functions/Index.java index 024bd7a05e..3c93c0846b 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Index.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Index.java @@ -90,19 +90,9 @@ public final class Index implements Function { } } - private static ValueEval getValueFromArea(AreaEval ae, int pRowIx, int pColumnIx) throws EvaluationException { + private static ValueEval getValueFromArea(AreaEval ae, int rowIx, int columnIx) throws EvaluationException { int width = ae.getWidth(); int height = ae.getHeight(); - int rowIx; - int columnIx; - if (ae.isRow() && pColumnIx == 0 && pRowIx > 0) { - // TODO - explore all these special cases - rowIx = 0; - columnIx = pRowIx; - } else { - rowIx = pRowIx; - columnIx = pColumnIx; - } // Slightly irregular logic for bounds checking errors if (rowIx >= height || columnIx >= width) { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java b/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java index 972a60aaae..e6a3ec81c2 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java @@ -17,7 +17,6 @@ package org.apache.poi.hssf.record.formula.functions; -import org.apache.poi.hssf.record.NumberRecord; import org.apache.poi.hssf.record.formula.eval.AreaEval; import org.apache.poi.hssf.record.formula.eval.BlankEval; import org.apache.poi.hssf.record.formula.eval.BoolEval; @@ -588,9 +587,7 @@ final class LookupUtils { if (lookupValue instanceof BlankEval) { // blank eval can never be found in a lookup array - //throw new EvaluationException(ErrorEval.NA); - // TODO - investigate this - return new NumberLookupComparer(NumberEval.ZERO); + throw new EvaluationException(ErrorEval.NA); } if (lookupValue instanceof StringEval) { return new StringLookupComparer((StringEval) lookupValue); diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java b/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java index f6b65f6495..54f7d465e5 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java @@ -60,16 +60,7 @@ public final class Vlookup implements Function { AreaEval tableArray = LookupUtils.resolveTableArrayArg(args[1]); boolean isRangeLookup = LookupUtils.resolveRangeLookupArg(arg3, srcCellRow, srcCellCol); int rowIndex = LookupUtils.lookupIndexOfValue(lookupValue, LookupUtils.createColumnVector(tableArray, 0), isRangeLookup); - ValueEval veColIndex; - try { - veColIndex = OperandResolver.getSingleValue(args[2], srcCellRow, srcCellCol); - } catch (EvaluationException e) { - // weird translation of errors for the third arg - needs investigation - if (e.getErrorEval() == ErrorEval.NA) { - return ErrorEval.REF_INVALID; - } - throw e; - } + ValueEval veColIndex = OperandResolver.getSingleValue(args[2], srcCellRow, srcCellCol); int colIndex = LookupUtils.resolveRowOrColIndexArg(veColIndex); ValueVector resultCol = createResultColumnVector(tableArray, colIndex); return resultCol.getItem(rowIndex); -- 2.39.5