ALF-10963 Cannot overwrite files on CIFS share with Notepad++

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32182 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2011-11-22 13:08:21 +00:00
parent 5b10c912b5
commit 4b2695745e
4 changed files with 37 additions and 9 deletions

View File

@@ -305,7 +305,8 @@ public class BufferedContentDiskDriver implements ExtendedDiskInterface,
if(logger.isDebugEnabled()) if(logger.isDebugEnabled())
{ {
logger.debug("getFileInformation path" + path + ", returning:" + finfo + logger.debug("Return getFileInformation, path: " + path +
", returning:" + finfo +
", readOnly:" +finfo.isReadOnly() + ", readOnly:" +finfo.isReadOnly() +
", fileId:" +finfo.getFileId() + ", fileId:" +finfo.getFileId() +
", fileSize:" +finfo.getSize() + ", fileSize:" +finfo.getSize() +
@@ -324,7 +325,7 @@ public class BufferedContentDiskDriver implements ExtendedDiskInterface,
if(logger.isDebugEnabled()) if(logger.isDebugEnabled())
{ {
logger.debug("getFileInformation returning:" + path + " returning" + info); logger.debug("getFileInformation Return:" + path + " returning" + info);
} }
return info; return info;

View File

@@ -819,6 +819,9 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
logger.debug("Started search: search path=" + searchPath + " attributes=" + attributes + ", ctx=" + searchCtx); logger.debug("Started search: search path=" + searchPath + " attributes=" + attributes + ", ctx=" + searchCtx);
} }
// TODO --
// Need to resolve the file info here so it's within the transaction boundary.
return searchCtx; return searchCtx;
} }
catch (org.alfresco.repo.security.permissions.AccessDeniedException ex) catch (org.alfresco.repo.security.permissions.AccessDeniedException ex)
@@ -1093,7 +1096,8 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
} }
else if ( params.isWriteOnlyAccess()) else if ( params.isWriteOnlyAccess())
{ {
netFile.setGrantedAccess( NetworkFile.WRITEONLY); // Needs to be READWRITE for JavaNetworkFile - there's no such thing as WRITEONLY!
netFile.setGrantedAccess( NetworkFile.READWRITE);
} }
else else
{ {
@@ -1867,7 +1871,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
{ {
if(logger.isDebugEnabled()) if(logger.isDebugEnabled())
{ {
logger.debug("write access denied to : + name"); logger.debug("write access denied to :" + name);
} }
throw new AccessDeniedException("No write access to " + name); throw new AccessDeniedException("No write access to " + name);
} }
@@ -1880,12 +1884,12 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
{ {
if(logger.isDebugEnabled()) if(logger.isDebugEnabled())
{ {
logger.debug("delete access denied to : + name"); logger.debug("Set Delete On Close for :" + name);
} }
// Check for delete permission // Check for delete permission
if ( permissionService.hasPermission(nodeRef, PermissionService.DELETE) == AccessStatus.DENIED) if ( permissionService.hasPermission(nodeRef, PermissionService.DELETE) == AccessStatus.DENIED)
{ {
throw new AccessDeniedException("No delete access to " + name); throw new AccessDeniedException("No delete access to :" + name);
} }
// Check if the node is locked // Check if the node is locked
@@ -2100,6 +2104,10 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
} }
catch (IOException ex) catch (IOException ex)
{ {
if(logger.isDebugEnabled())
{
logger.debug("unable to truncate the file + :" + file.getFullName(), ex);
}
// Check if we allocated space to the file // Check if we allocated space to the file
if ( allocSize > 0 && quotaMgr != null) if ( allocSize > 0 && quotaMgr != null)

View File

@@ -289,6 +289,11 @@ public class LegacyFileStateDriver implements ExtendedDiskInterface
{ {
ContentContext tctx = (ContentContext) tree.getContext(); ContentContext tctx = (ContentContext) tree.getContext();
if(logger.isDebugEnabled())
{
logger.debug("closeFile:" + param.getFullName() + ", accessToken:" + param.getAccessToken());
}
try try
{ {
diskInterface.closeFile(sess, tree, param); diskInterface.closeFile(sess, tree, param);
@@ -300,7 +305,7 @@ public class LegacyFileStateDriver implements ExtendedDiskInterface
if(fstate.getOpenCount() ==0 ) if(fstate.getOpenCount() ==0 )
{ {
logger.debug("reset shared access to READWRITEDELETE"); logger.debug("OpenCount = 0, reset shared access to READ WRITE DELETE");
fstate.setSharedAccess( SharingMode.READWRITE + SharingMode.DELETE); fstate.setSharedAccess( SharingMode.READWRITE + SharingMode.DELETE);
fstate.setAllocationSize(-1); fstate.setAllocationSize(-1);
@@ -311,10 +316,11 @@ public class LegacyFileStateDriver implements ExtendedDiskInterface
if(fstate != null && param.getAccessToken() != null) if(fstate != null && param.getAccessToken() != null)
{ {
FileAccessToken token = param.getAccessToken(); FileAccessToken token = param.getAccessToken();
if(logger.isDebugEnabled() && token != null) if(logger.isDebugEnabled() && token != null)
{ {
logger.debug("close file release lock token:" + token); logger.debug("close file release access token:" + token);
} }
cache.releaseFileAccess(fstate, token); cache.releaseFileAccess(fstate, token);
} }

View File

@@ -39,6 +39,7 @@ import org.alfresco.filesys.repo.rules.operations.RenameFileOperation;
import org.alfresco.jlan.server.SrvSession; import org.alfresco.jlan.server.SrvSession;
import org.alfresco.jlan.server.core.DeviceContext; import org.alfresco.jlan.server.core.DeviceContext;
import org.alfresco.jlan.server.core.DeviceContextException; import org.alfresco.jlan.server.core.DeviceContextException;
import org.alfresco.jlan.server.filesys.FileAction;
import org.alfresco.jlan.server.filesys.FileInfo; import org.alfresco.jlan.server.filesys.FileInfo;
import org.alfresco.jlan.server.filesys.FileName; import org.alfresco.jlan.server.filesys.FileName;
import org.alfresco.jlan.server.filesys.FileOpenParams; import org.alfresco.jlan.server.filesys.FileOpenParams;
@@ -308,8 +309,20 @@ public class NonTransactionalRuleContentDiskDriver implements ExtendedDiskInterf
+ ", isDeleteOnClose:" +param.isDeleteOnClose() + ", isDeleteOnClose:" +param.isDeleteOnClose()
+ ", allocationSize:" + param.getAllocationSize() + ", allocationSize:" + param.getAllocationSize()
+ ", sharedAccess: " + strSharedAccess + ", sharedAccess: " + strSharedAccess
+ ", openAction: " + param.getOpenAction()
); );
// TODO - If we are going to truncate then don't waste time copying content.
if (param.getOpenAction() == FileAction.NTOverwriteIf)
{
logger.debug("NTOverwriteIf");
}
if (param.getOpenAction() == FileAction.NTOverwrite)
{
logger.debug("NTOverwrite");
}
} }
ContentContext tctx = (ContentContext) tree.getContext(); ContentContext tctx = (ContentContext) tree.getContext();