You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by un...@apache.org on 2004/09/06 14:29:57 UTC

svn commit: rev 43416 - cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl

Author: unico
Date: Mon Sep  6 05:29:56 2004
New Revision: 43416

Modified:
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
Log:
fix bugzilla bug 31012, thanks to Oliver Powell (oliver.powell <at> tvnz.co.nz)

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java	Mon Sep  6 05:29:56 2004
@@ -48,7 +48,7 @@
  * @since 2.1
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  * @author <a href="mailto:Michael.Melhem@managesoft.com">Michael Melhem</a>
- * @version CVS $Id: AbstractCachingProcessingPipeline.java,v 1.19 2004/04/26 21:28:39 ugo Exp $
+ * @version CVS $Id$
  */
 public abstract class AbstractCachingProcessingPipeline
     extends BaseCachingProcessingPipeline {
@@ -566,6 +566,7 @@
                     // we are valid, ok that's it
                     this.cachedResponse = response.getResponse();
                     this.cachedLastModified = response.getLastModified();
+                    this.toCacheSourceValidities = fromCacheValidityObjects;
                 } else {
                     if (this.getLogger().isDebugEnabled()) {
                         this.getLogger().debug("validatePipeline: cached content is invalid for '" + environment.getURI() + "'.");
@@ -844,26 +845,35 @@
      * Otherwise return <code>null</code>
      */
     public SourceValidity getValidityForEventPipeline() {
-        int vals = 0;
-        
-        if ( null != this.toCacheKey
-             && !this.cacheCompleteResponse 
-             && this.firstNotCacheableTransformerIndex == super.transformers.size()) {
-             vals = this.toCacheKey.size();
-        } else if ( null != this.fromCacheKey
-                     && !this.completeResponseIsCached
-                     && this.firstProcessedTransformerIndex == super.transformers.size()) {
-             vals = this.fromCacheKey.size();
-        }
-        if ( vals > 0 ) {
+        if (this.cachedResponse != null && this.completeResponseIsCached) {
             final AggregatedValidity validity = new AggregatedValidity();
-            for(int i=0; i < vals; i++) {
-                validity.add(this.getValidityForInternalPipeline(i));
-                //validity.add(new DeferredPipelineValidity(this, i));
+            for (int i=0; i < this.toCacheSourceValidities.length; i++) {
+                validity.add(this.toCacheSourceValidities[i]);
             }
             return validity;
+
+        } else {
+            int vals = 0;
+            
+            if ( null != this.toCacheKey
+                 && !this.cacheCompleteResponse 
+                 && this.firstNotCacheableTransformerIndex == super.transformers.size()) {
+                 vals = this.toCacheKey.size();
+            } else if ( null != this.fromCacheKey
+                         && !this.completeResponseIsCached
+                         && this.firstProcessedTransformerIndex == super.transformers.size()) {
+                 vals = this.fromCacheKey.size();
+            }
+            if ( vals > 0 ) {
+                final AggregatedValidity validity = new AggregatedValidity();
+                for(int i=0; i < vals; i++) {
+                    validity.add(this.getValidityForInternalPipeline(i));
+                    //validity.add(new DeferredPipelineValidity(this, i));
+                }
+                return validity;
+            }
+            return null;
         }
-        return null;
     }
 
     /* (non-Javadoc)