You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2011/05/27 13:45:50 UTC

svn commit: r1128268 - in /poi/trunk/src: documentation/content/xdocs/status.xml java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java

Author: nick
Date: Fri May 27 11:45:50 2011
New Revision: 1128268

URL: http://svn.apache.org/viewvc?rev=1128268&view=rev
Log:
Fix bug #51273 - Hash codes can be negative when working on our own low memory hash for formula cell evaluation

Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1128268&r1=1128267&r2=1128268&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Fri May 27 11:45:50 2011
@@ -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>

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java?rev=1128268&r1=1128267&r2=1128268&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/FormulaCellCacheEntrySet.java Fri May 27 11:45:50 2011
@@ -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++) {



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