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 2012/10/11 22:51:07 UTC

svn commit: r1397300 - in /tomcat/sandbox/trunk-resources: ./ java/org/apache/catalina/webresources/Cache.java

Author: markt
Date: Thu Oct 11 20:51:07 2012
New Revision: 1397300

URL: http://svn.apache.org/viewvc?rev=1397300&view=rev
Log:
Fix NPE

Modified:
    tomcat/sandbox/trunk-resources/   (props changed)
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/Cache.java

Propchange: tomcat/sandbox/trunk-resources/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1393375-1396287

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/Cache.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/Cache.java?rev=1397300&r1=1397299&r2=1397300&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/Cache.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/Cache.java Thu Oct 11 20:51:07 2012
@@ -68,10 +68,6 @@ public class Cache {
 
         if (cacheEntry == null) {
             CachedResource newCacheEntry = new CachedResource(root, path, ttl);
-            if (newCacheEntry.getContentLength() > getMaxObjectSize()) {
-                return newCacheEntry;
-            }
-
             // Concurrent callers will end up with the same CachedResource
             // instance
             cacheEntry = resourceCache.putIfAbsent(path, newCacheEntry);
@@ -80,6 +76,10 @@ public class Cache {
                 // newCacheEntry was inserted into the cache - validate it
                 cacheEntry = newCacheEntry;
                 cacheEntry.validate();
+                if (newCacheEntry.getContentLength() > getMaxObjectSize()) {
+                    removeCacheEntry(path);
+                    return newCacheEntry;
+                }
 
                 // Assume that the cache entry will include the content.
                 // This isn't always the case but it makes tracking the



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