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

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 !!!

0 votes


Accepted answer

Permanent link

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.

 

Kallol Ghose selected this answer as the correct answer

0 votes

Comments

Thank You Ralph !!

Debugging helped me. There was a mistake on my end was using a wrong package for ItemProfile :(, which cause the issue.



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

Question asked: May 28 '17, 2:36 a.m.

Question was seen: 713 times

Last updated: May 29 '17, 8:29 a.m.

Confirmation Cancel Confirm