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

RTC API add/remove user corupts team area

I have a straightforward code to manipulate members in a team are:

IContributorManager conManager = repo.contributorManager();
IContributor contributor = conManager.fetchContributorByUserId(uid, new NullProgressMonitor());
IProcessItemService itemService = (IProcessItemService) repo.getClientLibrary(IProcessItemService.class);
List<IProjectArea> areas = itemService.findAllProjectAreas(null, null);

for (IProjectArea projectArea : areas) {
 IProjectArea mutableProjectCopy = (IProjectArea) itemService.getMutableCopy(projectArea);
 if ("some logic") {
 processArea.addMember(contributor);
 } else {
 processArea.removeMember(contributor);
 }
 // similar code omitted here for add/remove administrator
itemService.save(new IProjectArea[] {mutableProjectCopy}, null);
}

The code works for most of the time, but time-to-time the project area is corrupted, showing an exception below in the project view.

Does my code need any kind of synchronization/transaction etc.?

The following record was not found in the database:  com.ibm.team.repository.common.model.impl.ContributorHandleImpl@7f8c1d4f (stateId: , itemId: [UUID _8lNyYNwSEd2pIJ5QVwgQGg], origin: null, immutable: )ID CRJAZ0215E

com.ibm.team.repository.common.ItemNotFoundException
com.ibm.team.repository.service.internal.RepositoryItemService.doFetchItem(RepositoryItemService.java:575) com.ibm.team.repository.service.internal.RepositoryItemService.access$4(RepositoryItemService.java:568) com.ibm.team.repository.service.internal.RepositoryItemService$5.run(RepositoryItemService.java:548) com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$Transaction.run(RepositoryDatabase.java:567) com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$1.run(RepositoryDatabase.java:342) com.ibm.team.repository.service.internal.rdb.ConnectionPoolService.withNewDeferredConnection(ConnectionPoolService.java:545) com.ibm.team.repository.service.internal.rdb.ConnectionPoolService.withCurrentDeferredConnection(ConnectionPoolService.java:563) sun.reflect.GeneratedMethodAccessor228.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) java.lang.reflect.Method.invoke(Method.java:611) org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) com.sun.proxy.$Proxy143.withCurrentDeferredConnection(Unknown Source) com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:339)

0 votes



One answer

Permanent link
I use the same code in https://rsjazz.wordpress.com/2013/09/18/deploying-templates-and-creating-projects-using-the-plain-java-clients-library/ and I have never experienced an issue with it so far.

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,938
× 411

Question asked: Oct 21 '16, 8:46 a.m.

Question was seen: 3,458 times

Last updated: Oct 24 '16, 4:59 a.m.

Confirmation Cancel Confirm