NullPointerException when change state of workitem
Hi All,
When my plugin change the state of a existing workitem, it throws this exception. but the error log below does not tell me which line of my code cause the error. Any reply would be appreciate. Thanks java.lang.NullPointerException |
6 answers
Hi
How do you change the state of the work item? The only supported way is to set the action id to the working copy. Setting the state directly is not supported. Could you paste the code snippet that does not work? Regards Marcel Jazz Work Item team |
Hi Marcel,
It's really nice to see your reply here. I create a popup menu for the workitem, and all the possible state is a menu item in this menu. And each menu item has a ChangeWorkItemStateAction. ChangeWorkItemStateAction action= new ChangeWorkItemStateAction(workflowInfo.getActionName(actionId), workItem, actionId,this);
Thanks! |
Hi
This looks basically OK to me. I have opened defect 98932: NPE in RequiredAttributeCheck changing state using ChangeWorkItemStateOperation (https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/98932) to track the issue. Can you please comment in that work item which version of RTC you are using. Regards Marcel Jazz Work Item team |
Hi Marcel,
I can't open this page, the page is blank with only "Loading" in the center. So I am sorry maybe I can't give my comment on that page. There is something else about this problem, when i run/debug my plugin code, it works just fine. When I depoly it into plugin, and use it in the real Jazz environment, this problem start to appear. Regards~ Yaoben Hi |
I have select my version and os, and give comment to it. So is there anything I can do to help?
Hi |
The below metioned code for changing workitem state is not working for me.
private static class ChangeWorkItemStateAction extends Action { private IWorkItem fWorkItem; private Identifier<IWorkflowAction> fActionId; private EasyInspectAllView view; public ChangeWorkItemStateAction(String name, IWorkItem workItem, Identifier<IWorkflowAction> actionId,EasyInspectAllView view) { super(name); fWorkItem= workItem; fActionId= actionId; this.view=view; } @Override public void run() { if (fWorkItem == null) return; WorkItemOperation operation= new ChangeWorkItemStateOperation("Changing state", fActionId); try { operation.run(fWorkItem, null); view.refreshInspections(); view.getCommentViewer().expandToLevel(2); } catch (TeamRepositoryException e) { e.printStackTrace(); } } } In the above code 'ChangeWorkItemStateOperation' method seems erroneuos. Please help me to fix it. |
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.