aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2014-07-03 11:21:03 +0000
committerNick Burch <nick@apache.org>2014-07-03 11:21:03 +0000
commit4c8504965f25723d50fa44183e090989abae991e (patch)
tree6195a7199adc93c95035ed3a885415dcbf1540da
parent3105bd6f1881fbf3f699261479a13f13bdd1a5c5 (diff)
downloadpoi-4c8504965f25723d50fa44183e090989abae991e.tar.gz
poi-4c8504965f25723d50fa44183e090989abae991e.zip
Update the CheckFunctionsSupported example to take advantage of the new NotImplementedFunctionException to identify the function that is missing
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1607589 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/examples/src/org/apache/poi/ss/examples/formula/CheckFunctionsSupported.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/examples/src/org/apache/poi/ss/examples/formula/CheckFunctionsSupported.java b/src/examples/src/org/apache/poi/ss/examples/formula/CheckFunctionsSupported.java
index 0477e47327..cf6c176cc8 100644
--- a/src/examples/src/org/apache/poi/ss/examples/formula/CheckFunctionsSupported.java
+++ b/src/examples/src/org/apache/poi/ss/examples/formula/CheckFunctionsSupported.java
@@ -27,6 +27,7 @@ import java.util.Set;
import java.util.TreeSet;
import org.apache.poi.ss.formula.eval.NotImplementedException;
+import org.apache.poi.ss.formula.eval.NotImplementedFunctionException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Row;
@@ -128,10 +129,14 @@ public class CheckFunctionsSupported {
try {
evaluator.evaluate(c);
} catch (Exception e) {
- if (e instanceof NotImplementedException) {
- NotImplementedException nie = (NotImplementedException)e;
- // TODO
- System.err.println("TODO - Not Implemented: " + nie);
+ if (e instanceof NotImplementedException && e.getCause() != null) {
+ // Has been wrapped with cell details, but we know those
+ e = (Exception)e.getCause();
+ }
+
+ if (e instanceof NotImplementedFunctionException) {
+ NotImplementedFunctionException nie = (NotImplementedFunctionException)e;
+ unsupportedFunctions.add(nie.getFunctionName());
}
unevaluatableCells.put(new CellReference(c), e);
}