It's all about the answers!

Ask a question

NP when accessing workflow states using java plain API


Anders Truelsen (16212020) | asked Jan 29 '14, 3:01 a.m.
edited Jan 29 '14, 3:02 a.m.

"How do I get state of a work item?" ("scm.exe compare blabla" does not output state of work item)

We've tried the following:
 Given some project area, we need to locate the work item types:

  IProjectArea pr_area = …;

  IWorkItemClient wiclient = (IWorkItemClient)repo.getClientLibrary(IWorkItemClient.class);

  List<IWorkItemType> witypes = wiclient.findWorkItemTypes(pr_area, null);

 

Calling findWorkItemTypes() gives NullPointerException. See attached trace.

 

 

We also need to get info about state on work items:

  IWorkItem iwi = ...;

  IWorkItemClient wiiClient = (IWorkItemClient)repo.getClientLibrary(IWorkItemClient.class); 

  IWorkflowInfo  info = wiiClient.findWorkflowInfo(iwi, null);

 

Calling findWorkflowInfo() also gives a NullPointerException ending in same line of org.apache.xerces.util.ParserConfigurationSettings.java


Any input on how to move ahead is welcome :-)


Stacktrace:

13:09:08 [E] Caused by: java.lang.NullPointerException

13:09:08 [E] at java.util.Hashtable.put(Hashtable.java:542)

13:09:08 [E] at org.apache.xerces.util.ParserConfigurationSettings.setProperty(Unknown Source)

13:09:08 [E] at org.apache.xerces.parsers.XML11Configuration.setProperty(Unknown Source)

13:09:08 [E] at org.apache.xerces.parsers.AbstractSAXParser.setProperty(Unknown Source)

13:09:08 [E] at com.ibm.team.process.internal.common.model.ModelGenerator.enableValidation(ModelGenerator.java:106)

13:09:08 [E] at com.ibm.team.process.internal.common.model.ModelGenerator.generate(ModelGenerator.java:86)

13:09:08 [E] at com.ibm.team.process.internal.client.ThinClientProcess.createConfigurationData(ThinClientProcess.java:342)

13:09:08 [E] at com.ibm.team.process.internal.client.ThinClientProcess.getProjectConfigurationData(ThinClientProcess.java:280)

13:09:08 [E] at com.ibm.team.workitem.client.internal.AuditableClientProcess.findProcessConfiguration(AuditableClientProcess.java:72)

13:09:08 [E] at com.ibm.team.workitem.common.internal.ConfigurationItemManager.resolveProcessConfiguration(ConfigurationItemManager.java:124)

13:09:08 [E] at com.ibm.team.workitem.common.internal.ConfigurationItemManager.readConfigurationItems(ConfigurationItemManager.java:107)

13:09:08 [E] at com.ibm.team.workitem.common.internal.WorkItemTypeManager.readConfigurationItems(WorkItemTypeManager.java:370)

13:09:08 [E] at com.ibm.team.workitem.common.internal.ConfigurationItemManager.updateCache(ConfigurationItemManager.java:99)

13:09:08 [E] at com.ibm.team.workitem.common.internal.util.CacheHelper.internalCheckCache(CacheHelper.java:107)

13:09:08 [E] at com.ibm.team.workitem.common.internal.util.CacheHelper.checkCache(CacheHelper.java:73)

13:09:08 [E] at com.ibm.team.workitem.common.internal.util.CacheHelper.checkCache(CacheHelper.java:65)

13:09:08 [E] at com.ibm.team.workitem.common.internal.ConfigurationItemManager.findConfigurationItems(ConfigurationItemManager.java:48)

13:09:08 [E] at com.ibm.team.workitem.common.internal.WorkItemCommon.findWorkItemTypes(WorkItemCommon.java:408)

13:09:08 [E] at com.systematic.javaenv.internal.teamconcert.changequery.RTC.defineBasics(RTC.java:165)

13:09:08 [E] at com.systematic.javaenv.internal.teamconcert.changequery.RTC.execute(RTC.java:112)

13:09:08 [E] ... 21 more



Comments
Susan Hanson commented Jan 29 '14, 7:04 a.m.

Have you looked at if you are getting a WorkItemClient back from your first line?

I have code that basically does the same thing for fineWorkflowInfo(workItem,null) from the WorkItemClient() and for findWorkItemTypes(project_area,null).

Susan

2 answers



permanent link
Thomas Alexandersen (2324) | answered Jan 29 '14, 9:02 a.m.
Issue has been solved. There was no problem with code. Initially, the code was executed from within an Ant context (http://ant.apache.org). Somehow Ant apparently made certain properties inaccessible. When running the job without Ant, but with the same java + jars, the code works fine.

permanent link
Lauren Hayward Schaefer (3.3k11727) | answered Jan 29 '14, 7:39 a.m.
JAZZ DEVELOPER
As Susan suggests, it sounds like your work item client is null.  I have very similar code that works:
  IWorkItemClient workItemClient= (IWorkItemClient)repo.getClientLibrary(IWorkItemClient.class);
  IWorkItem handle= workItemClient.findWorkItemById(workItemId, IWorkItem.SMALL_PROFILE, monitor);
Do you have com.ibm.team.workitem.client listed as a required bundle in your plugin's manifest?

Your answer


Register or 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.