From 561fbcf4a0c0bd8605c9b17754b28f7f20f521da Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Wed, 23 Sep 2015 10:56:05 +0000 Subject: [PATCH] Merged HEAD (5.1) to 5.1.N (5.1.1) 112630 gjames: Removed the use of Locale.setDefault(locale) ACE-4246 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@112681 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../action/ParameterizedItemAbstractBase.java | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/source/java/org/alfresco/repo/action/ParameterizedItemAbstractBase.java b/source/java/org/alfresco/repo/action/ParameterizedItemAbstractBase.java index c414244875..426256d19e 100644 --- a/source/java/org/alfresco/repo/action/ParameterizedItemAbstractBase.java +++ b/source/java/org/alfresco/repo/action/ParameterizedItemAbstractBase.java @@ -108,32 +108,24 @@ public abstract class ParameterizedItemAbstractBase extends CommonResourceAbstra addParameterDefinitions(paramList); Map> result = new HashMap>(); result.put(Locale.ROOT, paramList); - Locale currentLocale = Locale.getDefault(); - try + + for (Locale locale : locales) { - for (Locale locale : locales) + List definitions = new LinkedList(); + result.put(locale, definitions); + for (ParameterDefinition definition : paramList) { - Locale.setDefault(locale); - List definitions = new LinkedList(); - result.put(locale, definitions); - for (ParameterDefinition definition : paramList) - { - String paramDisplayLabel = getParamDisplayLabel(definition.getName()); - definitions.add( - new ParameterDefinitionImpl( - definition.getName(), - definition.getType(), - definition.isMandatory(), - paramDisplayLabel, - definition.isMultiValued() - )); - } + String paramDisplayLabel = getParamDisplayLabel(definition.getName(), locale); + definitions.add( + new ParameterDefinitionImpl( + definition.getName(), + definition.getType(), + definition.isMandatory(), + paramDisplayLabel, + definition.isMultiValued() + )); } } - finally - { - Locale.setDefault(currentLocale); - } return result; } @@ -194,11 +186,22 @@ public abstract class ParameterizedItemAbstractBase extends CommonResourceAbstra * @param paramName the name of the parameter * @return the diaplay label of the parameter */ - protected String getParamDisplayLabel(String paramName) + protected String getParamDisplayLabel(String paramName) { return I18NUtil.getMessage(this.name + "." + paramName + "." + DISPLAY_LABEL); } - + + /** + * Gets the parameter definition display label from the properties file. + * + * @param paramName the name of the parameter + * @param locale the name of the locale + * @return the display label of the parameter + */ + protected String getParamDisplayLabel(String paramName, Locale locale) + { + return I18NUtil.getMessage(this.name + "." + paramName + "." + DISPLAY_LABEL, locale); + } /** * Checked whether all the mandatory parameters for the rule item have been assigned. *