It's all about the answers!

Ask a question

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


Rinkal Garg (175) | asked May 15 '18, 3:04 a.m.
edited Jun 01 '18, 3:25 p.m. by David Lafreniere (4.1k7)

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)


Comments
Rinkal Garg commented May 15 '18, 5:52 a.m.

 @rschoon Can you help me in this?

One answer



permanent link
David Lafreniere (4.1k7) | answered Jun 01 '18, 3:24 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
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?

Your answer


Register or to post your answer.