mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-9605: Failure to create thumbnails during simultaneous upload of similarly named files
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31740 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -239,38 +239,34 @@ public class ThumbnailServiceImpl implements ThumbnailService,
|
|||||||
logger.debug("Creating thumbnail (node=" + node.toString() + "; contentProperty="
|
logger.debug("Creating thumbnail (node=" + node.toString() + "; contentProperty="
|
||||||
+ contentProperty.toString() + "; mimetype=" + mimetype);
|
+ contentProperty.toString() + "; mimetype=" + mimetype);
|
||||||
}
|
}
|
||||||
checkThumbnailNameIsUnique(node, thumbnailName, contentProperty, mimetype);
|
|
||||||
return AuthenticationUtil.runAs(
|
if (thumbnailName != null)
|
||||||
new AuthenticationUtil.RunAsWork<NodeRef>()
|
|
||||||
{
|
|
||||||
public NodeRef doWork() throws Exception
|
|
||||||
{
|
|
||||||
return createThumbnailNode(node, contentProperty,
|
|
||||||
mimetype, transformationOptions, thumbnailName, assocDetails);
|
|
||||||
}
|
|
||||||
}, AuthenticationUtil.getSystemUserName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Throws a ThumbnailException if a thumbnail of this name already exists.
|
|
||||||
* @param node
|
|
||||||
* @param thumbnailName
|
|
||||||
* @param contentProperty
|
|
||||||
* @param mimetype
|
|
||||||
*/
|
|
||||||
private void checkThumbnailNameIsUnique(final NodeRef node, final String thumbnailName,
|
|
||||||
final QName contentProperty, final String mimetype)
|
|
||||||
{
|
|
||||||
if (thumbnailName != null && getThumbnailByName(node, contentProperty, thumbnailName) != null)
|
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled() == true)
|
NodeRef existingThumbnail = getThumbnailByName(node, contentProperty, thumbnailName);
|
||||||
|
if (existingThumbnail != null)
|
||||||
{
|
{
|
||||||
logger.debug("Creating thumbnail: There is already a thumbnail with the name '" + thumbnailName + "' (node=" + node.toString() + "; contentProperty=" + contentProperty.toString() + "; mimetype=" + mimetype);
|
if (logger.isDebugEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.debug("Creating thumbnail: There is already a thumbnail with the name '" + thumbnailName + "' (node=" + node.toString() + "; contentProperty=" + contentProperty.toString() + "; mimetype=" + mimetype);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the thumbnail that has already been created
|
||||||
|
return existingThumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can't continue because there is already a thumbnail with the given name for that content property
|
|
||||||
throw new ThumbnailException(ERR_DUPLICATE_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<NodeRef>()
|
||||||
|
{
|
||||||
|
public NodeRef doWork() throws Exception
|
||||||
|
{
|
||||||
|
return createThumbnailNode( node,
|
||||||
|
contentProperty,
|
||||||
|
mimetype,
|
||||||
|
transformationOptions,
|
||||||
|
thumbnailName,
|
||||||
|
assocDetails);
|
||||||
|
}
|
||||||
|
}, AuthenticationUtil.getSystemUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private QName getThumbnailQName(String localThumbnailName)
|
private QName getThumbnailQName(String localThumbnailName)
|
||||||
|
Reference in New Issue
Block a user