mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
59732: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3) 59504: MNT-10255: Merged DEV to V4.2-BUG-FIX (4.2.1). 59393: MNT-10255 Mac OS -CIFS: Collaborator/editor can delete content created by other site members after editing. - In ScenarioTempDeleteShuffle.createInstance() was added check: (operation instanceof MoveFileOperation). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62175 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -28,6 +28,7 @@ import java.util.regex.Pattern;
|
|||||||
import org.alfresco.filesys.repo.rules.ScenarioInstance.Ranking;
|
import org.alfresco.filesys.repo.rules.ScenarioInstance.Ranking;
|
||||||
import org.alfresco.filesys.repo.rules.operations.CreateFileOperation;
|
import org.alfresco.filesys.repo.rules.operations.CreateFileOperation;
|
||||||
import org.alfresco.filesys.repo.rules.operations.DeleteFileOperation;
|
import org.alfresco.filesys.repo.rules.operations.DeleteFileOperation;
|
||||||
|
import org.alfresco.filesys.repo.rules.operations.MoveFileOperation;
|
||||||
import org.alfresco.jlan.server.filesys.FileName;
|
import org.alfresco.jlan.server.filesys.FileName;
|
||||||
import org.alfresco.util.MaxSizeMap;
|
import org.alfresco.util.MaxSizeMap;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@@ -110,6 +111,46 @@ public class ScenarioTempDeleteShuffle implements Scenario
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (operation instanceof MoveFileOperation)
|
||||||
|
{
|
||||||
|
MoveFileOperation mf = (MoveFileOperation)operation;
|
||||||
|
|
||||||
|
// check whether file is below .TemporaryItems
|
||||||
|
String path = mf.getFromPath();
|
||||||
|
|
||||||
|
// if path contains .TemporaryItems
|
||||||
|
Matcher d = tempDirPattern.matcher(path);
|
||||||
|
if(d.matches())
|
||||||
|
{
|
||||||
|
logger.debug("pattern matches temp dir folder so this is a new create in a temp dir");
|
||||||
|
Matcher m = pattern.matcher(mf.getFrom());
|
||||||
|
if(m.matches())
|
||||||
|
{
|
||||||
|
// and how to lock - since we are already have one lock on the scenarios/folder here
|
||||||
|
// this is a potential deadlock and synchronization bottleneck
|
||||||
|
Map<String, String> createdTempFiles = (Map<String,String>)ctx.getSessionState().get(SCENARIO_KEY);
|
||||||
|
|
||||||
|
if(createdTempFiles == null)
|
||||||
|
{
|
||||||
|
synchronized(ctx.getSessionState())
|
||||||
|
{
|
||||||
|
logger.debug("created new temp file map and added it to the session state");
|
||||||
|
createdTempFiles = (Map<String,String>)ctx.getSessionState().get(SCENARIO_KEY);
|
||||||
|
if(createdTempFiles == null)
|
||||||
|
{
|
||||||
|
createdTempFiles = Collections.synchronizedMap(new MaxSizeMap<String, String>(5, false));
|
||||||
|
ctx.getSessionState().put(SCENARIO_KEY, createdTempFiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
createdTempFiles.remove(mf.getFrom());
|
||||||
|
|
||||||
|
// TODO - Return a different scenario instance here ???
|
||||||
|
// So it can time out and have anti-patterns etc?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(operation instanceof DeleteFileOperation)
|
if(operation instanceof DeleteFileOperation)
|
||||||
{
|
{
|
||||||
DeleteFileOperation c = (DeleteFileOperation)operation;
|
DeleteFileOperation c = (DeleteFileOperation)operation;
|
||||||
|
Reference in New Issue
Block a user