Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Error happended "The userId is null" when creating a work item whose type is "Task" via Java plain API

First: I can connect to RTC server v4.0.2
Second : I can create a work time whose type is "Epic"
Third: I cannot create a work item whose type is "Task" by following code.
Why can I create Epic work item but Task?
And when RTC server is V4.0.0.1, everything worked. Now RTC server is upgraded to V4.0.2, it doesn't work for "Task" work item.
private IWorkItem createWorkItem(WorkItemDetail workitem,IIteration sprint,ICategoryHandle category) throws WICException {
      
        try{
            IWorkItemType workItemType = null;
            // if work item type doesn't change, don't need to create new one.
            // the work item type is reset to null for each epic.
          
            if (workItemType == null
                    || !workItemType.getDisplayName().equals(
                            workitem.getWorkitemType())) {
                if (workitem.getWorkitemType().equalsIgnoreCase(TemplateConstants.SPRINT)) {
                    // in spreadsheet, the sprint will be created as epic.
                    workItemType = getWorkitemTypeById(projectArea,
                            TemplateConstants.EPIC);
                } else {
                    workItemType = getWorkitemTypeById(projectArea,
                            workitem.getWorkitemType());
                }
            }
            WorkItemInitialization operation = new WorkItemInitialization(
                    workitem, category, teamRepository, priorityMap, sprint,
                    storyPointAttr);
            IWorkItemHandle handle = operation.run(workItemType, null);
}
Error happened when executing this line " IWorkItemHandle handle = operation.run(workItemType, null);"
Error is:


java.lang.IllegalArgumentException: The userId is null
    at com.ibm.team.repository.client.internal.ContributorManager.fetchContributorByUserId(ContributorManager.java:224)
    at com.ibm.workitemCreator.rtc.WorkItemInitialization.findContributorByName(WorkItemInitialization.java:125)
    at com.ibm.workitemCreator.rtc.WorkItemInitialization.execute(WorkItemInitialization.java:86)
    at com.ibm.team.workitem.client.WorkItemOperation.execute(WorkItemOperation.java:85)
    at com.ibm.team.workitem.client.WorkItemOperation.doRun(WorkItemOperation.java:272)
    at com.ibm.team.workitem.client.WorkItemOperation.run(WorkItemOperation.java:242)
    at com.ibm.team.workitem.client.WorkItemOperation.run(WorkItemOperation.java:189)
    at com.ibm.workitemCreator.rtc.RTCClientManager.createWorkItem(RTCClientManager.java:425)

0 votes



One answer

Permanent link
Sorry code is following exactly:
private IWorkItem createWorkItem(WorkItemDetail workitem,IIteration sprint,ICategoryHandle category) throws WICException {
      
        try{
            IWorkItemType workItemType = null;
            // if work item type doesn't change, don't need to create new one.
            // the work item type is reset to null for each epic.
          
            if (workItemType == null
                    || !workItemType.getDisplayName().equals(
                            workitem.getWorkitemType())) {
                if (workitem.getWorkitemType().equalsIgnoreCase(TemplateConstants.SPRINT)) {
                    // in spreadsheet, the sprint will be created as epic.
                    workItemType = getWorkitemTypeById(projectArea,
                            "Epic");
                } else {
                    workItemType = getWorkitemTypeById(projectArea,
                            "Task");
                }
            }
            WorkItemInitialization operation = new WorkItemInitialization(
                    workitem, category, teamRepository, priorityMap, sprint,
                    storyPointAttr);
            IWorkItemHandle handle = operation.run(workItemType, null);
}

BTW, other variables are correct types because I created "Epic" work item via that code.

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 1,701

Question asked: Jun 06 '13, 10:01 a.m.

Question was seen: 3,909 times

Last updated: Jun 06 '13, 10:27 a.m.

Confirmation Cancel Confirm