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

@@ -374,14 +374,23 @@ 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, else
ClassificationWebService.this.searchService, {
ClassificationWebService.this.namespaceService)); 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);