It's all about the answers!

Ask a question

how to ressolve com.ibm.team.repository.common.StaleDataException ?


vinitha dsouza (147223136) | asked Jan 23 '17, 8:14 a.m.

Hello  Team

i am Creating Iterations automatically using client libraries .

I want to generate 2 iteartion at a time ,i am able to create one iteartion successfully when it tries to create the second iteration it throws me an error :

Exception in thread "main" com.ibm.team.repository.common.StaleDataException: CRJAZ0223I The following item has been changed by another operation:
Input
: com.ibm.team.process.internal.common.impl.DevelopmentLineImpl@3fb40234 (stateId: [UUID _lTUeM-FtEeaiosrJ0FhAzA], itemId: [UUID _bSq88AanEeS0iaGUWBwblA], origin: <unset>, immutable: true) (contextId: [UUID _ltV88T_eEeO3W9y9iL4-mw], modified: 2017-01-23 14:12:25.235, workingCopy: <unset>) (mergePredecessor: null, workingCopyPredecessor: <unset>, workingCopyMergePredecessor: <unset>, predecessor: [UUID _SyzJUOFtEeaiosrJ0FhAzA]) (name: Development Timeline, id: Function Team 1, descSummary: , archived: false, internalStartDate: null, internalEndDate: null)
Current: com.ibm.team.process.internal.common.impl.DevelopmentLineImpl@87319ec (stateId: [UUID _lQ74keFtEeaiosrJ0FhAzA], itemId: [UUID _bSq88AanEeS0iaGUWBwblA], origin: <unset>, immutable: true) (contextId: [UUID _ltV88T_eEeO3W9y9iL4-mw], modified: 2017-01-23 14:12:24.985, workingCopy: <unset>) (mergePredecessor: null, workingCopyPredecessor: <unset>, workingCopyMergePredecessor: <unset>, predecessor: [UUID _SyzJUOFtEeaiosrJ0FhAzA]) (name: Development Timeline, id: Function Team 1, descSummary: , archived: false, internalStartDate: null, internalEndDate: null)

below is my code used to create itearation :
IProcessItemService service = (IProcessItemService)AutoIteration.teamRepository
                .getClientLibrary(IProcessItemService.class);

        IIteration newIteration = (IIteration) IIteration.ITEM_TYPE
                .createItem();
         IdCreator idcreator=new IdCreator();
   
    String[] details=    idcreator.getIdDetails();
       
        newIteration.setName(details[0]);
        newIteration.setId(details[0]+details[1]);
        try {
            newIteration.setStartDate(sdf.parse(details[1]));
        } catch (ParseException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        try {
            newIteration.setEndDate(sdf.parse(details[2]));
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
       
        IIterationHandle iIterationHandle1 = newIteration;
        AutoIteration.developmentLine.insertIterationAfter(newIteration, iIterationHandle1);

        AutoIteration.developmentLine.addIteration((IIterationHandle) newIteration
                .getItemHandle());

        newIteration.setDevelopmentLine(AutoIteration.developmentLine);

        IProgressMonitor monitor = null;
       
        service.save(new IProcessItem[] { AutoIteration.developmentLine, newIteration },
                (org.eclipse.core.runtime.IProgressMonitor) monitor);
       
   

 

Accepted answer


permanent link
Ralph Schoon (63.7k33648) | answered Jan 23 '17, 9:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Stale data exception means, that an object has been modified compared to the version that is currently saved. The best hint I can give is to resolve the items before doing the next save. For example resolve the timeline after the save. See https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ for hints for some of these topics.

Ralph Schoon selected this answer as the correct answer

Comments
David Lafreniere commented Jan 11 '19, 4:32 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

Exactly, you probably need to re-fetch the developmentLine so that you are working with the latest copy, and then try to add the iteration to that.

Your answer


Register or 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.