From 3a2a6c999f776f64d0771016f299822eaa22091f Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Wed, 14 Nov 2007 20:09:23 +0000 Subject: [PATCH] Fix for AR-1871 - ML ui trying to set locale as a String rather than a Locale git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7387 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../content/EditContentPropertiesDialog.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java b/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java index f78191d9fd..ff8bbc9b58 100644 --- a/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/content/EditContentPropertiesDialog.java @@ -31,6 +31,7 @@ import java.util.Map; import javax.faces.context.FacesContext; +import org.alfresco.i18n.I18NUtil; import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.PropertyDefinition; @@ -156,20 +157,27 @@ public class EditContentPropertiesDialog extends BaseDialogBean Serializable propValue = (Serializable)editedProps.get(propName); // check for empty strings when using number types, set to null in this case - if ((propValue != null) && (propValue instanceof String) && - (propValue.toString().length() == 0)) + if (propValue instanceof String) { PropertyDefinition propDef = this.dictionaryService.getProperty(qname); - if (propDef != null) + if (((String)propValue).length() == 0) { - if (propDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) || - propDef.getDataType().getName().equals(DataTypeDefinition.FLOAT) || - propDef.getDataType().getName().equals(DataTypeDefinition.INT) || - propDef.getDataType().getName().equals(DataTypeDefinition.LONG)) + if (propDef != null) { - propValue = null; + if (propDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) || + propDef.getDataType().getName().equals(DataTypeDefinition.FLOAT) || + propDef.getDataType().getName().equals(DataTypeDefinition.INT) || + propDef.getDataType().getName().equals(DataTypeDefinition.LONG)) + { + propValue = null; + } } } + // handle locale strings to Locale objects + else if (propDef != null && propDef.getDataType().getName().equals(DataTypeDefinition.LOCALE)) + { + propValue = I18NUtil.parseLocale((String)propValue); + } } repoProps.put(qname, propValue);