Merge V2.2 to HEAD

ALF-1801 - Empty category array throws NPE

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19895 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2010-04-19 13:26:29 +00:00
parent 591d314e66
commit 8f0e7fddc1

View File

@@ -373,16 +373,25 @@ public class ClassificationWebService extends AbstractWebService implements
{ {
ClassificationWebService.this.nodeService.addAspect(nodeRef, aspect, null); ClassificationWebService.this.nodeService.addAspect(nodeRef, aspect, null);
} }
ArrayList<NodeRef> categoryNodeRefs = new ArrayList<NodeRef>(category.getCategories().length); Reference[] categories = category.getCategories();
for (Reference categoryReference : category.getCategories()) ArrayList<NodeRef> categoryNodeRefs = null;
if(categories == null)
{ {
categoryNodeRefs.add(Utils.convertToNodeRef( categoryNodeRefs = new ArrayList<NodeRef>(0);
categoryReference,
ClassificationWebService.this.nodeService,
ClassificationWebService.this.searchService,
ClassificationWebService.this.namespaceService));
} }
else
{
categoryNodeRefs = new ArrayList<NodeRef>(categories.length);
for (Reference categoryReference : categories)
{
categoryNodeRefs.add(Utils.convertToNodeRef(
categoryReference,
ClassificationWebService.this.nodeService,
ClassificationWebService.this.searchService,
ClassificationWebService.this.namespaceService));
}
}
ClassificationWebService.this.nodeService.setProperty(nodeRef, propertyName, categoryNodeRefs); ClassificationWebService.this.nodeService.setProperty(nodeRef, propertyName, categoryNodeRefs);
@@ -418,7 +427,7 @@ public class ClassificationWebService extends AbstractWebService implements
throw new ClassificationFault(0, e.getMessage()); throw new ClassificationFault(0, e.getMessage());
} }
} }
/** /**
* @see org.alfresco.repo.webservice.classification.ClassificationServiceSoapPort#describeClassification(org.alfresco.repo.webservice.types.Reference) * @see org.alfresco.repo.webservice.classification.ClassificationServiceSoapPort#describeClassification(org.alfresco.repo.webservice.types.Reference)
*/ */