poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Vb <i8c.a...@gmail.com>
Subject RuntimeException when external excel not found
Date Fri, 11 May 2012 09:36:48 GMT
When evaluating a formula in a cell, I got a runtime exception with the
following (partial) stacktrace:

    at
org.apache.poi.ss.formula.OperationEvaluationContext.createExternSheetRefEvaluator(OperationEvaluationContext.java:89)
    at
org.apache.poi.ss.formula.OperationEvaluationContext.getRef3DEval(OperationEvaluationContext.java:249)
    at
org.apache.poi.ss.formula.WorkbookEvaluator.getEvalForPtg(WorkbookEvaluator.java:607)
    at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:493)
    at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:287)
    at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:229)
    at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCellValue(HSSFFormulaEvaluator.java:354)
    at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluate(HSSFFormulaEvaluator.java:185)

It seems the class org.apache.poi.ss.formula.OperationEvaluationContext
throws a runtime exception if an external workbook is not found. Is there a
reason for this design decision?

I would suggest:
- a formula error (e.g. "#REF")
- or a checked exception
- or if all else fails, an unchecked exception but a subtype so we don't
have to catch RuntimeException and a mention of this behavior in the
javadocs because until it occurred I had no idea this behavior was expected

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message