Skip to content

Commit cdff9a6

Browse files
author
Riyad Kalla
committedMar 16, 2011
Fixed bug with Integer cache never getting cleared.
1 parent 8910b99 commit cdff9a6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎src/main/java/com/thebuzzmedia/sjxp/XMLParser.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,8 @@ protected void doEndDocument(T userObject) {
851851
* @author Riyad Kalla (software@thebuzzmedia.com)
852852
*/
853853
class Location {
854+
private static final int HASH_CODE_CACHE_SIZE = 512;
855+
854856
private int hashCode;
855857
private Integer[] hashCodeCache;
856858

@@ -862,7 +864,7 @@ class Location {
862864
*/
863865
public Location() {
864866
hashCode = 0;
865-
hashCodeCache = new Integer[512];
867+
hashCodeCache = new Integer[HASH_CODE_CACHE_SIZE];
866868

867869
path = new StringBuilder(256);
868870
lengthList = new ArrayList<Integer>(16);
@@ -960,6 +962,7 @@ else if (hashCode != value.intValue())
960962
*/
961963
public void clear() {
962964
hashCode = 0;
965+
hashCodeCache = new Integer[HASH_CODE_CACHE_SIZE];
963966

964967
path.setLength(0);
965968
lengthList.clear();

0 commit comments

Comments
 (0)