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

How to locate a change set in stream using plain java API?

I am using the below code :
 List<IChangeSetHandle> changeSetHandle = convertToChangeSetHandles(

change.getItemId().getUuidValue().toString());

IWorkspaceSearchCriteria wsSearchCriteria1 = IWorkspaceSearchCriteria.FACTORY.newInstance();
wsSearchCriteria1.setKind(IWorkspaceSearchCriteria.WORKSPACES);
wsSearchCriteria1.setExactName(connectedStreamNew.getName());
List<IWorkspaceHandle> streamHandleList1 = workspaceManager.findWorkspaces(wsSearchCriteria1,
Integer.MAX_VALUE, monitor);
ILocateChangeSetsSearchCriteria scope = ILocateChangeSetsSearchCriteria.FACTORY
.create(changeSetHandle, streamHandleList1, Collections.EMPTY_LIST, Collections.EMPTY_LIST);
IWorkspaceManager workspaceManager1 = SCMPlatform.getWorkspaceManager(repoCasa);
List<ILocateChangeSetsSearchResult> result = workspaceManager1.locateChangeSets(scope, monitor);

But in last line of code I am getting an exception :Exception in thread "main" java.lang.IllegalArgumentException
at com.ibm.team.scm.client.internal.WorkspaceManager.locateChangeSets(WorkspaceManager.java:252)

0 votes

Comments

 @rschoon Can you help me in this?



One answer

Permanent link
The IllegalArgumentException is thrown due to this code:

            if (scope.getWorkspaces().isEmpty() && scope.getSnapshots().isEmpty() && scope.getBaselines().isEmpty()) {
                throw new IllegalArgumentException("The search criteria scope must provide at least one workspace, snapshot or baseline"); //$NON-NLS-1$
            }

This means that in your case 'streamHandleList1' is empty, which can very well be, as you are trying to find all repository workspaces which appear to have the name of some stream (with the exact name of: "connectedStreamNew.getName()")

What is it you were trying to do there?

0 votes

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
× 10,932
× 1,202
× 169

Question asked: May 15 '18, 3:04 a.m.

Question was seen: 3,088 times

Last updated: Jun 01 '18, 3:25 p.m.

Confirmation Cancel Confirm