Author: cbrisson
Date: Sun Mar  3 12:59:26 2019
New Revision: 1854700

URL: http://svn.apache.org/viewvc?rev=1854700&view=rev
Log:
[engine] Fix VELOCITY-851

Modified:
    
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java

Modified: 
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
URL: 
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?rev=1854700&r1=1854699&r2=1854700&view=diff
==============================================================================
--- 
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
 (original)
+++ 
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
 Sun Mar  3 12:59:26 2019
@@ -496,6 +496,8 @@ public class ResourceManagerImpl
          * AST for the resource.
          */
 
+        String resourceKey = resource.getType() + resource.getName();
+
         /*
          *  touch() the resource to reset the counters
          */
@@ -510,7 +512,11 @@ public class ResourceManagerImpl
             String name = resource.getName();
             if (loader != getLoaderForResource(name))
             {
-                return loadResource(name, resource.getType(), encoding);
+                resource = loadResource(name, resource.getType(), encoding);
+                if (resource.getResourceLoader().isCachingOn())
+                {
+                    globalCache.put(resourceKey, resource);
+                }
             }
         }
 
@@ -535,8 +541,6 @@ public class ResourceManagerImpl
              */
             long howOldItWas = loader.getLastModified(resource);
 
-            String resourceKey = resource.getType() + resource.getName();
-
             /*
              * we create a copy to avoid partially overwriting a
              * template which may be in use in another thread


Reply via email to