It's all about the answers!

Ask a question

nullpointer Exception when setting category to null


Moti Wertheimer (18913628) | asked Jan 10 '10, 5:39 a.m.
JAZZ DEVELOPER
Hi,

I have a plugin that deletes all information from workitem and setting it's type to some custom "archived" type.
All is working fine, except when setting the category to null.
I have tried setting to "unassigned" too, same behavior.

It looks like that:
IWorkItem workItem = wc.getWorkItem();
workItem.setOwner(contributorManager
.fetchContributorByUserId("unassigned", null));
workItem.setTarget(null);
// workItem.setCategory(null);
IAttribute attrType = workItemClient.findAttribute(
projectArea, IWorkItem.TYPE_PROPERTY, null);
IWorkItemType zArchivedType = workItemCommon
.findWorkItemType(projectArea, "archived", null);
workItem.setValue(attrType, zArchivedType.getIdentifier());
IWorkItemReferences references = wc.getReferences();
List<IEndPointDescriptor> refTypes = references.getTypes();
for (IEndPointDescriptor endPointDescriptor : refTypes) {
List<IReference> refList = references
.getReferences(endPointDescriptor);
for (IReference reference : refList) {
references.remove(reference);
}
}
IDetailedStatus status = wc.save(null);

2 answers



permanent link
Patrick Streule (4.9k21) | answered Jan 11 '10, 5:08 a.m.
JAZZ DEVELOPER
I have a plugin that deletes all information from workitem and setting
it's type to some custom "archived" type.
All is working fine, except when setting the category to null.
I have tried setting to "unassigned" too, same behavior.

The category must not be 'null'. But setting it to 'Unassigned' should
work. Please see also

com.ibm.team.workitem.common.IWorkItemCommon.findUnassignedCategory(IProjectAreaHandle,
ItemProfile<ICategory>, IProgressMonitor)

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Jacek Kisynski (611) | answered Jan 17 '12, 9:18 p.m.
I have a plugin that deletes all information from workitem and setting
it's type to some custom "archived" type.
All is working fine, except when setting the category to null.
I have tried setting to "unassigned" too, same behavior.

The category must not be 'null'. But setting it to 'Unassigned' should
work. Please see also

com.ibm.team.workitem.common.IWorkItemCommon.findUnassignedCategory(IProjectAreaHandle,
ItemProfile<ICategory>, IProgressMonitor)

--
Regards,
Patrick
Jazz Work Item Team

What about setting Release to 'Unassigned'? I can't find a release eith this name using com.ibm.team.workitem.common.IWorkItemCommon.findDeliverableByName(...)

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.