RTC API Exception : Attempting to get unset feature: Category though the value in the workitem is set.
Hello All,
I need to fetch the Task workitem's Category(Filed Against) value. I am using the following code :
com.ibm.team.workitem.common.model.IAttribute attributename=rtcDataAccessProvider.getWorkItemClient((ITeamRepository)currentWorkItem.getOrigin()).findAttribute(currentWorkItem.getProjectArea(), IWorkItem.CATEGORY_PROPERTY, monitor);
if(currentWorkItem.hasAttribute(attributename )){
Object value =currentWorkItem.getValue(attributename);
}
Am getting the following exception, though the category value is set for the Task.
Exception in thread "main" java.lang.IllegalStateException: Attempting to get unset feature: Category
at com.ibm.team.workitem.common.internal.model.impl.WorkItemImpl.getCategory(WorkItemImpl.java:1672)
at com.ibm.team.workitem.common.internal.model.impl.WorkItemImpl.eGet(WorkItemImpl.java:2352)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1021)
However same code is working fine for other workitems. Is there any other way for accessing the Task's attribute ?
Please assist.
One answer
I have explained what I know here: https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/
I can't identify what rtcDataAccessProvider is. Nor is it clear where in the statement the error actually happens.
attributename is a bad name for the IAttribute, because you use the name to get the IAttribute.
Otherwise it is almost impossible to remote debug this kind of stuff.