You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/04/11 00:02:14 UTC

svn commit: r1586478 - in /tomcat/trunk: java/org/apache/catalina/webresources/CachedResource.java webapps/docs/changelog.xml

Author: markt
Date: Thu Apr 10 22:02:14 2014
New Revision: 1586478

URL: http://svn.apache.org/r1586478
Log:
Ensure that the static resource cache is able to detect when a cache entry is invalidated by being overridden by a new resource in a different WebResourceSet

Modified:
    tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java?rev=1586478&r1=1586477&r2=1586478&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java (original)
+++ tomcat/trunk/java/org/apache/catalina/webresources/CachedResource.java Thu Apr 10 22:02:14 2014
@@ -89,8 +89,9 @@ public class CachedResource implements W
             return true;
         }
 
-        if (!webResource.exists() && root.getResourceInternal(
-                webAppPath, useClassLoaderResources).exists()) {
+        WebResource webResourceInternal = root.getResourceInternal(
+                webAppPath, useClassLoaderResources);
+        if (!webResource.exists() && webResourceInternal.exists()) {
             return false;
         }
 
@@ -101,6 +102,13 @@ public class CachedResource implements W
             return false;
         }
 
+        // Has a resource been inserted / removed in a different resource set
+        if (webResource.getLastModified() != webResourceInternal.getLastModified() ||
+                webResource.getContentLength() != webResourceInternal.getContentLength()) {
+            return false;
+        }
+
+
         nextCheck = ttl + now;
         return true;
     }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1586478&r1=1586477&r2=1586478&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Apr 10 22:02:14 2014
@@ -83,6 +83,11 @@
         <bug>56365</bug>: Simplify file name pattern matching code in
         <code>StandardJarScanner</code>. (kkolinko)
       </scode>
+      <fix>
+        Ensure that the static resource cache is able to detect when a cache
+        entry is invalidated by being overridden by a new resource in a
+        different <code>WebResourceSet</code>. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org