Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

98874: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud)
      98718: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.2)
         98561: Merged NESS/4.2.N-2015-02-10 (4.2.5) to V4.2-BUG-FIX (4.2.5)
            98467: MNT-13358 : Share fails to render imported documents when metadata has empty cm:creator or cm:modifier values
               - modified the username decorator and the people bean to handle empty usernames
            98550: MNT-13358 : Share fails to render imported documents when metadata has empty cm:creator or cm:modifier values
               - added unit tests and corrected formating of previous commit


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@98951 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-03-06 22:36:03 +00:00
parent bcd9bfd7bc
commit d3331bcd0f
3 changed files with 14 additions and 2 deletions

View File

@@ -966,7 +966,7 @@ public class People extends BaseScopableProcessorExtension implements Initializi
{ {
NodeRef personRef = null; NodeRef personRef = null;
ParameterCheck.mandatoryString("Username", username); ParameterCheck.mandatory("Username", username);
try try
{ {
personRef = personService.getPersonOrNull(username); personRef = personService.getPersonOrNull(username);

View File

@@ -60,7 +60,12 @@ public class UsernamePropertyDecorator extends BasePropertyDecorator
// DO NOT change this to just use getPersonOrNullImpl // DO NOT change this to just use getPersonOrNullImpl
// - there is Cloud THOR prod hack see personServiceImpl.personExists // - there is Cloud THOR prod hack see personServiceImpl.personExists
// - and THOR-293 // - and THOR-293
if (this.personService.personExists(username)) if (username.isEmpty())
{
firstName = "";
lastName = "";
}
else if (this.personService.personExists(username))
{ {
NodeRef personRef = this.personService.getPerson(username, false); NodeRef personRef = this.personService.getPerson(username, false);
firstName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME); firstName = (String)this.nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME);

View File

@@ -245,6 +245,13 @@ public class IntegrityTest extends TestCase
checkIntegrityNoFailure(); checkIntegrityNoFailure();
} }
public void testCreateWithEmptyMandatoryProperty() throws Exception
{
allProperties.put(TEST_PROP_TEXT_A, "");
NodeRef nodeRef = createNode("abc", TEST_TYPE_WITH_PROPERTIES, allProperties);
checkIntegrityNoFailure();
}
public void testMandatoryPropertiesRemoved() throws Exception public void testMandatoryPropertiesRemoved() throws Exception
{ {
NodeRef nodeRef = createNode("abc", TEST_TYPE_WITH_PROPERTIES, allProperties); NodeRef nodeRef = createNode("abc", TEST_TYPE_WITH_PROPERTIES, allProperties);