From 8f5fa9bb4ec93bcde65adde1cbd667492bc1165e Mon Sep 17 00:00:00 2001 From: Tomasz Stanczak Date: Mon, 8 Aug 2016 12:18:05 +0200 Subject: [PATCH] On cache misses add cells on the fly to the evaluation sheet's cache. --- .../apache/poi/xssf/usermodel/XSSFEvaluationSheet.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java index c25dfb5..a3bac86 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java @@ -67,7 +67,21 @@ final class XSSFEvaluationSheet implements EvaluationSheet { } } - return _cellCache.get(new CellKey(rowIndex, columnIndex)); + final CellKey key = new CellKey(rowIndex, columnIndex); + EvaluationCell evalcell = _cellCache.get(key); + if (evalcell == null) { + XSSFRow row = _xs.getRow(rowIndex); + if (row == null) { + return null; + } + XSSFCell cell = row.getCell(columnIndex); + if (cell == null) { + return null; + } + evalcell = new XSSFEvaluationCell(cell, this); + _cellCache.put(key, evalcell); + } + return evalcell; } private static class CellKey { -- 2.9.0.windows.1