Error programmatically getting approvals
![]()
I have some code that reads approvals programmatically. Most of them I have issues with, but a couple I get an odd error:
java.lang.IllegalArgumentException: itemHandle must not be null and must not have a null state id com.ibm.team.repository.common.model.impl.ContributorHandleImpl@41104110 (stateId: <unset>, itemId: [UUID _4TNJsCxDEd-osPt1oXgcDw], origin: com.ibm.team.repository.client.internal.TeamRepository@4ed44ed4, immutable: true) at com.ibm.team.repository.client.internal.ItemManager.fetchCompleteState(ItemManager.java:1014) I've looked at the actual defect approvals on the Approvals tab (in Eclipse client) and I see nothing odd or unique. They have a person actually assigned as an approver and that person is a valid, unarchived person. I'm not sure why these ones may be unique, so I thought I would ask. Here is the code I am using. for (IWorkItem item : items) { IApprovals approvals = item.getApprovals(); //get the approvals List<IApproval> individualApprovals = approvals.getContents(); //get each approval for (IApproval approval : individualApprovals) { IApprovalDescriptor descrip = approval.getDescriptor(); IContributorHandle owner = approval.getApprover(); String userid = "unableToRetrieve"; try { IContributor ownerObject = rtcm.getContributorFromHandle(owner); userid = ownerObject.getUserId(); } catch (Exception e) { e.printStackTrace(); } } } The getContributorFromHandle() method calls this: itemManager().fetchCompleteState(handle, monitor); |