It's all about the answers!

Ask a question

Getting exception on IQueryResult


Kallol Ghose (152) | asked May 28 '17, 2:36 a.m.

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


permanent link
Ralph Schoon (59.7k23643) | answered May 28 '17, 12:49 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited May 28 '17, 12:50 p.m.

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

Comments
Kallol Ghose commented May 29 '17, 8:28 a.m. | edited May 29 '17, 8:29 a.m.

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 to post your answer.