cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r375257 - /cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/generation/DirectoryGenerator.java
Date Mon, 06 Feb 2006 11:44:31 GMT
Author: jbq
Date: Mon Feb  6 03:44:29 2006
New Revision: 375257

URL: http://svn.apache.org/viewcvs?rev=375257&view=rev
Log:
Fix COCOON-1681: Generator "directory": Caching too much

Modified:
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/generation/DirectoryGenerator.java

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/generation/DirectoryGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/generation/DirectoryGenerator.java?rev=375257&r1=375256&r2=375257&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/generation/DirectoryGenerator.java
(original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/generation/DirectoryGenerator.java
Mon Feb  6 03:44:29 2006
@@ -54,7 +54,7 @@
  *               Uses the last modification date of the directory and the contained files
  * 
  * @cocoon.sitemap.component.pooling.max  16
- *  
+ *
  * @version $Id$
  */
 public class DirectoryGenerator 
@@ -512,28 +512,29 @@
 
         public int isValid() {
             if (System.currentTimeMillis() <= expiry) {
-                return 1;
+                return SourceValidity.VALID;
             }
 
-            expiry = System.currentTimeMillis() + delay;
             int len = files.size();
             for (int i = 0; i < len; i++) {
                 File f = (File)files.get(i);
                 if (!f.exists()) {
-                    return -1; // File was removed
+                    return SourceValidity.INVALID; // File was removed
                 }
 
                 long oldDate = ((Long)fileDates.get(i)).longValue();
                 long newDate = f.lastModified();
 
                 if (oldDate != newDate) {
-                    return -1;
+                    // File's last modified date has changed since last check
+                    // NOTE: this occurs on directories as well when a file is added
+                    return SourceValidity.INVALID;
                 }
             }
 
             // all content is up to date: update the expiry date
             expiry = System.currentTimeMillis() + delay;
-            return 1;
+            return SourceValidity.VALID;
         }
 
         public int isValid(SourceValidity newValidity) {



Mime
View raw message