Getting exception on IQueryResult
Hello,
I am trying to create a java program to get run a shared query. I am able to get the IQueryDescriptor object pertaining to the query selected by user. But when I am trying to get the result am getting exception (org.eclipse.core.runtime.AssertionFailedException: assertion failed).
Version being used : 6.0.1
PFB the function to get the result set
public static void getResultSet(ITeamRepository repository,IQueryDescriptor query)
{
try
{
IWorkItemClient workItemClient = (IWorkItemClient) repository.getClientLibrary(IWorkItemClient.class);
IQueryClient queryClient = workItemClient.getQueryClient();
ItemProfile loadProfile = IQueryDescriptor.FULL_PROFILE;
IQueryResult<IResolvedResult<IWorkItem>> resolvedResults = queryClient.getResolvedQueryResults(query, loadProfile);
long processed = 0;
System.out.println("Size : " + resolvedResults.getResultSize(null).getTotal());
while(resolvedResults.hasNext(null))
{
IResolvedResult<IWorkItem> result = resolvedResults.next(null);
IWorkItem item = result.getItem();
System.out.println(item.getItemId());
processed++;
}
System.out.println("Processed : " + processed);
}
catch(Exception e)
{
System.out.println("Exception : " + e.getMessage());
e.printStackTrace();
}
}
Getting exception -
org.eclipse.core.runtime.AssertionFailedException: assertion failed:
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
at com.ibm.team.workitem.common.internal.util.AuditablesHelper.assertItemType(AuditablesHelper.java:98)
at com.ibm.team.workitem.common.internal.util.AuditablesHelper.getProperties(AuditablesHelper.java:77)
at com.ibm.team.workitem.client.internal.AuditableClient.doResolveAuditables(AuditableClient.java:173)
at com.ibm.team.workitem.client.internal.AuditableClient.resolveAuditables(AuditableClient.java:144)
at com.ibm.team.workitem.common.internal.query.QueryCommon.resolveAuditables(QueryCommon.java:314)
at com.ibm.team.workitem.client.internal.QueryClient.resolveAuditables(QueryClient.java:135)
at com.ibm.team.workitem.common.internal.query.ResolvingQueryResultIterator.createIterator(ResolvingQueryResultIterator.java:142)
at com.ibm.team.workitem.common.internal.query.ResolvingQueryResultIterator.update(ResolvingQueryResultIterator.java:125)
at com.ibm.team.workitem.common.internal.query.ResolvingQueryResultIterator.nextPage(ResolvingQueryResultIterator.java:101)
Could someone please tell me how to remove the exception.
Thanks in advance !!!
Accepted answer
Without line numbers?
Get your envirmonment set up for debugging, I think. How to is in the blog https://rsjazz.wordpress.com/2012/10/29/using-work-item-queris-for-automation/ where your code originates (just a guess), the processed++ triggered something. Maybe consider https://jazz.net/forum/questions/203755/how-should-i-ask-a-question-in-the-forum-if-i-want-to-receive-useful-answers, especially providing which line of your code causes the exception. During debugging you should be able to find out more.
Also note that the work item commandline has working code to run a query.