From 8b10d4d71bb55f4140adfee76605c291b28dce90 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Wed, 6 Apr 2016 19:50:14 +0000 Subject: [PATCH] Tried to evaluate all formulas in worksheets as part of the integration tests, but some documents fail and it probably increases runtime of tests considerably, so left commented out for now. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1738034 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/stress/SpreadsheetHandler.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/integrationtest/org/apache/poi/stress/SpreadsheetHandler.java b/src/integrationtest/org/apache/poi/stress/SpreadsheetHandler.java index adf8f16e7..123bfa745 100644 --- a/src/integrationtest/org/apache/poi/stress/SpreadsheetHandler.java +++ b/src/integrationtest/org/apache/poi/stress/SpreadsheetHandler.java @@ -44,7 +44,7 @@ public abstract class SpreadsheetHandler extends AbstractFileHandler { // write once more ByteArrayOutputStream out = writeToArray(wb); - // read in the writen file + // read in the written file Workbook read; try { read = WorkbookFactory.create(new ByteArrayInputStream(out.toByteArray())); @@ -93,6 +93,21 @@ public abstract class SpreadsheetHandler extends AbstractFileHandler { } private void modifyContent(Workbook wb) { + /* a number of file fail because of various things: udf, unimplemented functions, ... + we would need quite a list of excludes and the large regression tests would probably + take a lot longer to run... + try { + // try to re-compute all formulas to find cases where parsing fails + wb.getCreationHelper().createFormulaEvaluator().evaluateAll(); + } catch (RuntimeException e) { + // only allow a specific exception which indicates that an external + // reference was not found + if(!e.getMessage().contains("Could not resolve external workbook name")) { + throw e; + } + + }*/ + for (int i=wb.getNumberOfSheets()-1; i>=0; i--) { try { wb.cloneSheet(i);