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,8 +374,16 @@ 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 = new ArrayList<NodeRef>(0);
}
else
{
categoryNodeRefs = new ArrayList<NodeRef>(categories.length);
for (Reference categoryReference : categories)
{ {
categoryNodeRefs.add(Utils.convertToNodeRef( categoryNodeRefs.add(Utils.convertToNodeRef(
categoryReference, categoryReference,
@@ -383,6 +391,7 @@ public class ClassificationWebService extends AbstractWebService implements
ClassificationWebService.this.searchService, ClassificationWebService.this.searchService,
ClassificationWebService.this.namespaceService)); ClassificationWebService.this.namespaceService));
} }
}
ClassificationWebService.this.nodeService.setProperty(nodeRef, propertyName, categoryNodeRefs); ClassificationWebService.this.nodeService.setProperty(nodeRef, propertyName, categoryNodeRefs);