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); |
One answer
Hello Susan,
this article https://jazz.net/library/article/1118
might help you here.
Thanks.
Eric.
Comments
Susan Hanson
commented Mar 20 '13, 10:05 p.m.
I got a bit more on this ... so out of about 100 work items, I get this error on exactly 4 of them. These 4 I have verified the approval record WITH the actual approver exists (eclipse client). I also didn't find any pattern .. the approvers were different people, the approval record added by different people on different days.
Hello Susan,
as we only have the first line of the stack, not sure which line in your code is failing and causing the IllegalArgumentException
May you please point it out?
Thanks.
Eric.
Susan Hanson
commented Mar 22 '13, 12:46 a.m.
A bit more info ..I hit a new error today, and asked for details on what the person used to actually create the approval record:
|
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.