You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2011/08/09 04:28:48 UTC
svn commit: r1155192 -
/xerces/java/trunk/src/org/apache/xerces/util/SoftReferenceSymbolTable.java
Author: mrglavas
Date: Tue Aug 9 02:28:48 2011
New Revision: 1155192
URL: http://svn.apache.org/viewvc?rev=1155192&view=rev
Log:
Fixing JIRA Issue #1520: http://issues.apache.org/jira/browse/XERCESJ-1520. Corrects several problems with rehash() and removeEntry(), in particular a case where we were double counting cleared SoftReferences which could lead to fCount becoming negative.
Modified:
xerces/java/trunk/src/org/apache/xerces/util/SoftReferenceSymbolTable.java
Modified: xerces/java/trunk/src/org/apache/xerces/util/SoftReferenceSymbolTable.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/util/SoftReferenceSymbolTable.java?rev=1155192&r1=1155191&r2=1155192&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/util/SoftReferenceSymbolTable.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/util/SoftReferenceSymbolTable.java Tue Aug 9 02:28:48 2011
@@ -225,13 +225,16 @@ public class SoftReferenceSymbolTable ex
if (newTable[index] != null) {
newTable[index].prev = e;
}
+ e.bucket = index;
e.next = newTable[index];
- e.prev = null;
newTable[index] = e;
}
else {
- fCount--;
+ e.bucket = -1;
+ e.next = null;
+ --fCount;
}
+ e.prev = null;
}
}
}
@@ -298,16 +301,19 @@ public class SoftReferenceSymbolTable ex
} // containsSymbol(char[],int,int):boolean
private void removeEntry(SREntry entry) {
- if (entry.next != null) {
- entry.next.prev = entry.prev;
- }
- if (entry.prev != null) {
- entry.prev.next = entry.next;
- }
- else {
- fBuckets[entry.bucket] = entry.next;
+ final int bucket = entry.bucket;
+ if (bucket >= 0) {
+ if (entry.next != null) {
+ entry.next.prev = entry.prev;
+ }
+ if (entry.prev != null) {
+ entry.prev.next = entry.next;
+ }
+ else {
+ fBuckets[bucket] = entry.next;
+ }
+ --fCount;
}
- fCount--;
}
/**
@@ -339,6 +345,7 @@ public class SoftReferenceSymbolTable ex
/** The previous entry. */
public SREntry prev;
+ /** The bucket this entry is contained in; -1 if it has been removed from the table. */
public int bucket;
//
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org