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
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)
One answer
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$
}
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?
Comments
Rinkal Garg
May 15 '18, 5:52 a.m.@rschoon Can you help me in this?