mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-4865 - transfer service: transfer empty content property
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22682 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -780,17 +780,26 @@ public class RepoPrimaryManifestProcessorImpl extends AbstractManifestProcessorB
|
||||
{
|
||||
ContentData contentData = (ContentData) contentEntry.getValue();
|
||||
String contentUrl = contentData.getContentUrl();
|
||||
String fileName = TransferCommons.URLToPartName(contentUrl);
|
||||
File stagedFile = new File(stagingDir, fileName);
|
||||
if (!stagedFile.exists())
|
||||
if(contentUrl == null || contentUrl.isEmpty())
|
||||
{
|
||||
error(MSG_REFERENCED_CONTENT_FILE_MISSING);
|
||||
log.debug("content data is null or empty:" + nodeToUpdate);
|
||||
ContentData cd = new ContentData(null, null, 0, null);
|
||||
nodeService.setProperty(nodeToUpdate, contentEntry.getKey(), cd);
|
||||
}
|
||||
else
|
||||
{
|
||||
String fileName = TransferCommons.URLToPartName(contentUrl);
|
||||
File stagedFile = new File(stagingDir, fileName);
|
||||
if (!stagedFile.exists())
|
||||
{
|
||||
error(MSG_REFERENCED_CONTENT_FILE_MISSING);
|
||||
}
|
||||
ContentWriter writer = contentService.getWriter(nodeToUpdate, contentEntry.getKey(), true);
|
||||
writer.setEncoding(contentData.getEncoding());
|
||||
writer.setMimetype(contentData.getMimetype());
|
||||
writer.setLocale(contentData.getLocale());
|
||||
writer.putContent(stagedFile);
|
||||
}
|
||||
ContentWriter writer = contentService.getWriter(nodeToUpdate, contentEntry.getKey(), true);
|
||||
writer.setEncoding(contentData.getEncoding());
|
||||
writer.setMimetype(contentData.getMimetype());
|
||||
writer.setLocale(contentData.getLocale());
|
||||
writer.putContent(stagedFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user