Hi,

the ResourceReader does not check for the unavailability of an InputSource's
timestamp during generateKey() and generateValidity(). This may cause problems
with bogus data being served from the cache. The following patch modifies the
ResourceReader's behaviour to match the one of, for instance, FileGenerator.

Joerg Henne



Index: src/org/apache/cocoon/reading/ResourceReader.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/reading/ResourceReader.java,v
retrieving revision 1.8
diff -u -r1.8 src/org/apache/cocoon/reading/ResourceReader.java
--- ResourceReader.java 2001/08/22 03:51:05     1.8
+++ ResourceReader.java 2001/08/30 17:02:13
@@ -84,7 +84,10 @@
      * @return The generated key hashes the src
      */
     public long generateKey() {
-        return HashUtil.hash(this.inputSource.getSystemId());
+        if (this.inputSource.getLastModified() != 0) {
+            return HashUtil.hash(this.inputSource.getSystemId());
+        }
+        return 0;
     }
 
     /**
@@ -94,7 +97,10 @@
      *         component is currently not cacheable.
      */
     public CacheValidity generateValidity() {
-        return new
TimeStampCacheValidity(this.inputSource.getLastModified());
+        if (this.inputSource.getLastModified() != 0) {
+            return new
TimeStampCacheValidity(this.inputSource.getLastModified());
+        }
+        return null;
     }
 
     /**

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to