Return-Path: Delivered-To: apmail-jakarta-velocity-dev-archive@www.apache.org Received: (qmail 710 invoked from network); 4 Jan 2006 05:31:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Jan 2006 05:31:13 -0000 Received: (qmail 71424 invoked by uid 500); 4 Jan 2006 05:31:13 -0000 Delivered-To: apmail-jakarta-velocity-dev-archive@jakarta.apache.org Received: (qmail 71217 invoked by uid 500); 4 Jan 2006 05:31:12 -0000 Mailing-List: contact velocity-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Velocity Developers List" Reply-To: "Velocity Developers List" Delivered-To: mailing list velocity-dev@jakarta.apache.org Received: (qmail 71206 invoked by uid 500); 4 Jan 2006 05:31:12 -0000 Received: (qmail 71203 invoked by uid 99); 4 Jan 2006 05:31:12 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jan 2006 21:31:12 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 03 Jan 2006 21:31:11 -0800 Received: (qmail 616 invoked by uid 65534); 4 Jan 2006 05:30:51 -0000 Message-ID: <20060104053051.613.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r365829 - /jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java Date: Wed, 04 Jan 2006 05:30:50 -0000 To: velocity-cvs@jakarta.apache.org From: wglass@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: wglass Date: Tue Jan 3 21:30:46 2006 New Revision: 365829 URL: http://svn.apache.org/viewcvs?rev=365829&view=rev Log: Correct fix to VELOCITY-98. If page writer alternates #parse and #include for the same file, the file needs to be reloaded (can't reuse the cache). Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java Modified: jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java URL: http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?rev=365829&r1=365828&r2=365829&view=diff ============================================================================== --- jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java (original) +++ jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java Tue Jan 3 21:30:46 2006 @@ -22,6 +22,7 @@ import java.io.InputStream; import java.io.IOException; +import org.apache.velocity.Template; import org.apache.velocity.runtime.log.Log; import org.apache.velocity.runtime.RuntimeServices; import org.apache.velocity.runtime.RuntimeConstants; @@ -294,6 +295,23 @@ Resource resource = globalCache.get(resourceName); + /** + * Check to see if the type has changed and reload the file if so. + * For example, if a file has been loaded with #include and then #parse + * If so, reload the resource. + * + * Note that if a page repeatedly alternates #include and #parse + * on the same file the cache is essentially negated. + */ + if ( resource != null ) + { + if ( ((resourceType == RESOURCE_CONTENT) && !(resource instanceof ContentResource)) || + ((resourceType == RESOURCE_TEMPLATE) && !(resource instanceof Template)) ) + { + resource = null; + } + } + if( resource != null) { /* --------------------------------------------------------------------- To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: velocity-dev-help@jakarta.apache.org