aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/main/java
diff options
context:
space:
mode:
authorClaude Brisson <cbrisson@apache.org>2019-03-03 12:59:26 +0000
committerClaude Brisson <cbrisson@apache.org>2019-03-03 12:59:26 +0000
commit6adf5dff09c720a675feb9c955d0704e2122a120 (patch)
treeb92458fe77d6b31d173f9eebba43b7c7f1da99e8 /velocity-engine-core/src/main/java
parent7d76d51449df6ba55011aa0cb47b3fd7aff58863 (diff)
downloadapache-velocity-engine-6adf5dff09c720a675feb9c955d0704e2122a120.tar.gz
[engine] Fix VELOCITY-851
git-svn-id: https://svn.apache.org/repos/asf/velocity/engine/trunk@1854700 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'velocity-engine-core/src/main/java')
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
index 59cd2e33..c256239f 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
@@ -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