Merged BRANCHES/V3.2 to HEAD:

19807: Fix ALF-2318 - failed to add WCM content (without description or title)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19815 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka 2010-04-12 11:55:29 +00:00
parent 464c52891b
commit d6eeff6fb1
2 changed files with 13 additions and 2 deletions

View File

@ -257,6 +257,7 @@ public class PropertyValue implements Cloneable, Serializable
@Override
protected ValueType getPersistedType(Serializable value)
{
// NOTE: since 2.2.1, PropertyValue is only used by AVM (which does not natively support MLText, other than single/default string)
if (value instanceof MLText)
{
MLText mlText = (MLText) value;
@ -269,7 +270,7 @@ public class PropertyValue implements Cloneable, Serializable
return ValueType.STRING;
}
}
else if (value instanceof String)
else if ((value == null) || (value instanceof String))
{
return ValueType.STRING;
}

View File

@ -51,7 +51,7 @@ public class PropertyValueTest extends TestCase
// single language
MLText mlText = new MLText(Locale.FRENCH, "bonjour");
PropertyValue propertyValue = new PropertyValue(DataTypeDefinition.MLTEXT, mlText);
assertNotNull("MLText not persisted as a string", propertyValue.getStringValue());
assertEquals("MLText not persisted as a string", "bonjour", propertyValue.getStringValue());
try
{
@ -69,6 +69,16 @@ public class PropertyValueTest extends TestCase
// NOTE: since 2.2.1, PropertyValue is only used by AVM (which does not natively support MLText, other than single/default string)
}
// single language - empty string
mlText = new MLText(Locale.FRENCH, "");
propertyValue = new PropertyValue(DataTypeDefinition.MLTEXT, mlText);
assertEquals("MLText not persisted as an empty string", "", propertyValue.getStringValue());
// single language - null string
mlText = new MLText(Locale.GERMAN, null);
propertyValue = new PropertyValue(DataTypeDefinition.MLTEXT, mlText);
assertNull("MLText not persisted as a null string", propertyValue.getStringValue());
return null;
}
};