Update the file size in the file state cache.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29745 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2011-08-15 09:49:14 +00:00
parent 5ddbcc938d
commit 8bdaffcfe2
4 changed files with 60 additions and 25 deletions

View File

@@ -226,12 +226,13 @@ public class BufferedContentDiskDriver implements ExtendedDiskInterface,
if(tctx.hasStateCache())
{
FileStateCache cache = tctx.getStateCache();
FileState fstate = tctx.getStateCache().findFileState(path, false);
FileState fstate = cache.findFileState(path, false);
if(fstate != null)
{
FileInfo finfo = new FileInfo();
finfo.copyFrom(info);
// TODO what if file state cache is stale or wrong? We are over-writing the "real" value.
if(fstate.hasFileSize())
{
finfo.setFileSize(fstate.getFileSize());
@@ -253,9 +254,23 @@ public class BufferedContentDiskDriver implements ExtendedDiskInterface,
finfo.setAllocationSize( fstate.getAllocationSize());
}
if(logger.isDebugEnabled())
{
logger.debug("getFileInformation path" + path + ", returning:" + finfo +
", readOnly:"+info.isReadOnly() +
", fileId:"+info.getFileId() +
", directoryId:" + info.getDirectoryId() +
", mode" + info.getMode());
}
return finfo;
}
}
if(logger.isDebugEnabled())
{
logger.debug("getFileInformation returning:" + path + " returning" + info);
}
return info;