poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1760213 - /poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java
Date Sun, 11 Sep 2016 02:02:56 GMT
Author: onealj
Date: Sun Sep 11 02:02:56 2016
New Revision: 1760213

URL: http://svn.apache.org/viewvc?rev=1760213&view=rev
Log:
bug 59958: Add cells on the fly to the evaluation sheet cache on cache miss; patch from Tomasz
Stanczak

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java?rev=1760213&r1=1760212&r2=1760213&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java Sun Sep
11 02:02:56 2016
@@ -67,7 +67,28 @@ final class XSSFEvaluationSheet implemen
             }
         }
         
-        return _cellCache.get(new CellKey(rowIndex, columnIndex));
+        final CellKey key = new CellKey(rowIndex, columnIndex);
+        EvaluationCell evalcell = _cellCache.get(key);
+        
+        // If cache is stale, update cache with this one cell
+        // This is a compromise between rebuilding the entire cache
+        // (which would quickly defeat the benefit of the cache)
+        // and not caching at all.
+        // See bug 59958: Add cells on the fly to the evaluation sheet cache on cache miss
+        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 {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message