ALF-9613: fix some cases of content being in in-memory cache but not on disk.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29957 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2011-08-22 14:55:18 +00:00
parent 7d8bd1abe3
commit a359d3cec9
4 changed files with 84 additions and 17 deletions

View File

@@ -63,7 +63,11 @@ public class ContentCacheImpl implements ContentCache
if (memoryStore.contains(contentUrl))
{
String path = memoryStore.get(contentUrl);
return new FileContentReader(new File(path), contentUrl);
File cacheFile = new File(path);
if (cacheFile.exists())
{
return new FileContentReader(cacheFile, contentUrl);
}
}
throw new CacheMissException(contentUrl);
@@ -173,4 +177,13 @@ public class ContentCacheImpl implements ContentCache
{
this.memoryStore = memoryStore;
}
// Not part of the ContentCache interface as this breaks encapsulation.
// Handy method for tests though, since it allows us to find out where
// the content was cached.
protected String cacheFileLocation(String url)
{
return memoryStore.get(url);
}
}