diff options
author | Nick Burch <nick@apache.org> | 2011-05-27 11:45:50 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2011-05-27 11:45:50 +0000 |
commit | 044c992853a25bf64f5a43453c136a660cc02ff2 (patch) | |
tree | f9ab8969afdc5a34f5ab49e16a406577baddb563 /src | |
parent | 67d2e1f6b06c15141b6625d345568d4979d558aa (diff) | |
download | poi-044c992853a25bf64f5a43453c136a660cc02ff2.tar.gz poi-044c992853a25bf64f5a43453c136a660cc02ff2.zip |
Fix bug #51273 - Hash codes can be negative when working on our own low memory hash for formula cell evaluation
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1128268 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/documentation/content/xdocs/status.xml | 1 | ||||
-rw-r--r-- | src/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java | 5 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index c0790c9f33..5da84b934b 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ <changes> <release version="3.8-beta3" date="2011-??-??"> + <action dev="poi-developers" type="fix">51273 - Formula Value Cache fix for repeated evaluations</action> <action dev="poi-developers" type="add">51171 - Improved performance of SharedValueManager </action> <action dev="poi-developers" type="fix">51236 - XSSF set colour support for black/white to match getter</action> <action dev="poi-developers" type="add">51196 - Initial support for Spreadsheet Chart API</action> diff --git a/src/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java b/src/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java index d8e573150e..9a40cbc95e 100644 --- a/src/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java +++ b/src/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java @@ -76,8 +76,7 @@ final class FormulaCellCacheEntrySet { private static boolean addInternal(CellCacheEntry[] arr, CellCacheEntry cce) { - - int startIx = cce.hashCode() % arr.length; + int startIx = Math.abs(cce.hashCode() % arr.length); for(int i=startIx; i<arr.length; i++) { CellCacheEntry item = arr[i]; @@ -130,7 +129,7 @@ final class FormulaCellCacheEntrySet { // else - usual case // delete single element (without re-hashing) - int startIx = cce.hashCode() % arr.length; + int startIx = Math.abs(cce.hashCode() % arr.length); // note - can't exit loops upon finding null because of potential previous deletes for(int i=startIx; i<arr.length; i++) { |