Author: vgritsenko Date: Wed Apr 13 14:59:24 2005 New Revision: 161219 URL: http://svn.apache.org/viewcvs?view=rev&rev=161219 Log: getValidityForEventPipeline must return null validity for partially cached responses
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java cocoon/branches/BRANCH_2_1_X/status.xml Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java?view=diff&r1=161218&r2=161219 ============================================================================== --- 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 Wed Apr 13 14:59:24 2005 @@ -371,11 +371,11 @@ this.toCacheSourceValidities = new SourceValidity[this.toCacheKey.size()]; + int len = this.toCacheSourceValidities.length; int i = 0; while (i < len) { - final SourceValidity validity = - this.getValidityForInternalPipeline(i); + final SourceValidity validity = getValidityForInternalPipeline(i); if (validity == null) { if (i > 0 @@ -390,8 +390,7 @@ this.cacheCompleteResponse = false; } SourceValidity[] copy = new SourceValidity[i]; - System.arraycopy(this.toCacheSourceValidities, 0, - copy, 0, copy.length); + System.arraycopy(this.toCacheSourceValidities, 0, copy, 0, copy.length); this.toCacheSourceValidities = copy; len = this.toCacheSourceValidities.length; } else { @@ -808,10 +807,12 @@ /** - * Return valid validity objects for the event pipeline - * If the "event pipeline" (= the complete pipeline without the + * Return valid validity objects for the event pipeline. + * + * If the event pipeline (the complete pipeline without the * serializer) is cacheable and valid, return all validity objects. - * Otherwise return <code>null</code> + * + * Otherwise, return <code>null</code>. */ public SourceValidity getValidityForEventPipeline() { if (isInternalError()) { @@ -819,6 +820,12 @@ } if (this.cachedResponse != null) { + if (!this.cacheCompleteResponse && + this.firstNotCacheableTransformerIndex < super.transformers.size()) { + // Cache contains only partial pipeline. + return null; + } + if (this.toCacheSourceValidities != null) { // This means that the pipeline is valid based on the validities // of the individual components @@ -826,32 +833,34 @@ for (int i=0; i < this.toCacheSourceValidities.length; i++) { validity.add(this.toCacheSourceValidities[i]); } + return validity; } - else { - // This means that the pipeline is valid because it has not yet expired - return NOPValidity.SHARED_INSTANCE; - } + + // This means that the pipeline is valid because it has not yet expired + return NOPValidity.SHARED_INSTANCE; } 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 (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 (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)); + for (int i = 0; i < vals; i++) { + validity.add(getValidityForInternalPipeline(i)); } + return validity; } + return null; } } Modified: cocoon/branches/BRANCH_2_1_X/status.xml URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&r1=161218&r2=161219 ============================================================================== --- cocoon/branches/BRANCH_2_1_X/status.xml (original) +++ cocoon/branches/BRANCH_2_1_X/status.xml Wed Apr 13 14:59:24 2005 @@ -196,6 +196,10 @@ <changes> <release version="@version@" date="@date@"> + <action dev="VG" type="fix"> + Fixed caching of a pipeline aggregating non cacheable pipelines via + <code>cocoon:</code> protocol. + </action> <action dev="VG" type="update"> Stacktrace of the ResourceNotFound exception is logged only in DEBUG level, otherwise only exception message is logged.