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
This commit is contained in:
Kevin Roast
2007-11-14 20:09:23 +00:00
parent edc6caa89c
commit 3a2a6c999f

View File

@@ -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);