cziegeler 2004/05/19 01:42:40
Modified: src/java/org/apache/cocoon/caching PipelineCacheKey.java ComponentCacheKey.java . status.xml Log: Fixing bug in hash code calculation - persistence is now working Revision Changes Path 1.3 +3 -4 cocoon-2.1/src/java/org/apache/cocoon/caching/PipelineCacheKey.java Index: PipelineCacheKey.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/caching/PipelineCacheKey.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- PipelineCacheKey.java 5 Mar 2004 13:02:45 -0000 1.2 +++ PipelineCacheKey.java 19 May 2004 08:42:40 -0000 1.3 @@ -30,10 +30,10 @@ implements Serializable { /** The keys */ - private List keys; + private final List keys; /** the hash code */ - private int hashCode = 0; + private int hashCode; /** * Constructor @@ -116,7 +116,6 @@ * Generate a hash code */ public int hashCode() { - // FIXME - this is not very safe if (this.hashCode == 0) { final int len = this.keys.size(); for(int i=0; i < len; i++) { 1.3 +10 -16 cocoon-2.1/src/java/org/apache/cocoon/caching/ComponentCacheKey.java Index: ComponentCacheKey.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/caching/ComponentCacheKey.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ComponentCacheKey.java 5 Mar 2004 13:02:45 -0000 1.2 +++ ComponentCacheKey.java 19 May 2004 08:42:40 -0000 1.3 @@ -41,15 +41,15 @@ private static final String[] COMPONENTS = { "X", "G", "X", "T", "X", "S", "X", "R" }; /** The component type */ - private int type; + private final int type; /** The component identifier */ - private String identifier; + private final String identifier; /** The unique key */ - private Serializable key; + private final Serializable key; /** the hash code */ - private int hashCode = 0; + private final int hashCode; /** cachePoint */ - private boolean cachePoint = false; + private final boolean cachePoint; /** * Constructor @@ -57,10 +57,7 @@ public ComponentCacheKey(int componentType, String componentIdentifier, Serializable cacheKey) { - this.type = componentType; - this.identifier = componentIdentifier; - this.key = cacheKey; - + this(componentType, componentIdentifier, cacheKey, false); } /** @@ -75,6 +72,9 @@ this.key = cacheKey; /** cachePoint */ this.cachePoint = cachePoint; + this.hashCode = this.type + + (this.identifier.length() << 3) + + this.key.hashCode(); } /** @@ -96,12 +96,6 @@ * HashCode */ public int hashCode() { - // FIXME - this is not very safe - if (this.hashCode == 0) { - this.hashCode = this.type + - (this.identifier.length() << 3) + - (this.key.hashCode() << 10); - } return this.hashCode; } 1.330 +5 -1 cocoon-2.1/status.xml Index: status.xml =================================================================== RCS file: /home/cvs/cocoon-2.1/status.xml,v retrieving revision 1.329 retrieving revision 1.330 diff -u -r1.329 -r1.330 --- status.xml 18 May 2004 16:19:58 -0000 1.329 +++ status.xml 19 May 2004 08:42:40 -0000 1.330 @@ -211,6 +211,10 @@ <changes> <release version="@version@" date="@date@"> + <action dev="CZ" type="fix"> + The persistent store is now really persistent between two application runs. (Fixed + a bug in the hash code calculation of the keys). + </action> <action dev="AG" type="update"> Updated Apache JCS to 1.0 dev 20040516 and util.concurrent to 1.3.3 </action>