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

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


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

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

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

13:09:08 [E] at

13:09:08 [E] at

13:09:08 [E] at

13:09:08 [E] at

13:09:08 [E] at

13:09:08 [E] at

13:09:08 [E] at

13:09:08 [E] at

13:09:08 [E] at

13:09:08 [E] at

13:09:08 [E] at

13:09:08 [E] at

13:09:08 [E] at

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

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

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

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).


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 ( 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.3k11527) | answered Jan 29 '14, 7:39 a.m.
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 listed as a required bundle in your plugin's manifest?

Your answer

Register or to post your answer.