mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Fix leaked 'MLPropertyInterceptor.setMLAware' in data load API implementation (ACE-4552)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@116895 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -279,36 +279,42 @@ public class FileFolderLoader
|
|||||||
{
|
{
|
||||||
// Add the cm:description additional properties
|
// Add the cm:description additional properties
|
||||||
boolean wasMLAware = MLPropertyInterceptor.setMLAware(true);
|
boolean wasMLAware = MLPropertyInterceptor.setMLAware(true);
|
||||||
MLText descriptions = new MLText();
|
try
|
||||||
String[] languages = Locale.getISOLanguages();
|
|
||||||
String defaultLanguage = Locale.getDefault().getLanguage();
|
|
||||||
// Create cm:description translations
|
|
||||||
for (int descriptionNum = -1; descriptionNum < (descriptionCount-1); descriptionNum++)
|
|
||||||
{
|
{
|
||||||
String language = null;
|
MLText descriptions = new MLText();
|
||||||
// Use the default language for the first description
|
String[] languages = Locale.getISOLanguages();
|
||||||
if (descriptionNum == -1)
|
String defaultLanguage = Locale.getDefault().getLanguage();
|
||||||
|
// Create cm:description translations
|
||||||
|
for (int descriptionNum = -1; descriptionNum < (descriptionCount-1); descriptionNum++)
|
||||||
{
|
{
|
||||||
language = defaultLanguage;
|
String language = null;
|
||||||
|
// Use the default language for the first description
|
||||||
|
if (descriptionNum == -1)
|
||||||
|
{
|
||||||
|
language = defaultLanguage;
|
||||||
|
}
|
||||||
|
else if (languages[descriptionNum].equals(defaultLanguage))
|
||||||
|
{
|
||||||
|
// Skip the default language, if we hit it
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
language = languages[descriptionNum];
|
||||||
|
}
|
||||||
|
Locale languageLocale = new Locale(language);
|
||||||
|
// For the cm:description, create new reader with a seed that changes each time
|
||||||
|
String descriptionUrl = SpoofedTextContentReader.createContentUrl(locale, seed + descriptionNum, descriptionSize);
|
||||||
|
SpoofedTextContentReader readerDescription = new SpoofedTextContentReader(descriptionUrl);
|
||||||
|
String description = readerDescription.getContentString();
|
||||||
|
descriptions.put(languageLocale, description);
|
||||||
}
|
}
|
||||||
else if (languages[descriptionNum].equals(defaultLanguage))
|
nodeService.setProperty(fileNodeRef, ContentModel.PROP_DESCRIPTION, descriptions);
|
||||||
{
|
}
|
||||||
// Skip the default language, if we hit it
|
finally
|
||||||
continue;
|
{
|
||||||
}
|
MLPropertyInterceptor.setMLAware(wasMLAware);
|
||||||
else
|
|
||||||
{
|
|
||||||
language = languages[descriptionNum];
|
|
||||||
}
|
|
||||||
Locale languageLocale = new Locale(language);
|
|
||||||
// For the cm:description, create new reader with a seed that changes each time
|
|
||||||
String descriptionUrl = SpoofedTextContentReader.createContentUrl(locale, seed + descriptionNum, descriptionSize);
|
|
||||||
SpoofedTextContentReader readerDescription = new SpoofedTextContentReader(descriptionUrl);
|
|
||||||
String description = readerDescription.getContentString();
|
|
||||||
descriptions.put(languageLocale, description);
|
|
||||||
}
|
}
|
||||||
nodeService.setProperty(fileNodeRef, ContentModel.PROP_DESCRIPTION, descriptions);
|
|
||||||
MLPropertyInterceptor.setMLAware(wasMLAware);
|
|
||||||
}
|
}
|
||||||
// Success
|
// Success
|
||||||
count.incrementAndGet();
|
count.incrementAndGet();
|
||||||
|
Reference in New Issue
Block a user