It's all about the answers!

Ask a question

RTC API Exception : Attempting to get unset feature: Category though the value in the workitem is set.


Jazzuser user (4818) | asked Nov 03 '17, 7:40 a.m.

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



permanent link
Ralph Schoon (57.2k23642) | answered Nov 03 '17, 8:43 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.

Your answer


Register or to post your answer.