Unable to save the same ProjectAreaWorkingCopy twice in a row. Stale Exception.
![]()
I've been trying to programatically change the process configuration XML. I've done it successfully, however I run into a problem when my application gets multiple requests to save in the same Project Area.
The problem that I have is that the save method returns successfully. Another request starts and then I get a:
com.ibm.team.repository.common.StaleDataException: UpdateItemCurrentRow failure: Params=[_WHQxglx_EeWFo6onmSus9Q,_uakdUNQmEeK9uYPg6dqTSg,_UqClklx_EeWFo6onmSus9Q]
Whats even stranger is that even tho the exception is thrown, the item gets saved correctly to the file. Is there a way to manually synchronize the save? Make sure its really really saved? Can I test if there is a save in progress?
I've already tried all sorts of tricks like checking if isDirty() before I try saving but nothing works. Help?
|
2 answers
![]()
I don't use the processarea directly..
I use the ProcessItem Client private static IProcessItemService destprocessItemClient = null; destprocessItemClient = (IProcessItemService) repo.getClientLibrary(IProcessItemService.class); // allocate arraylist to hold list of modified objects.. all have to be saved at one time. ArrayList<IProcessItem> newitemlist = new ArrayList<IProcessItem>(); // add the project to the list newitemlist.add((new IProcessItem[] { iprja_dest })[0]); do work, add modified items (working copies) to the arraylist as you go // allocate space for the array IProcessItem[] ilist = new IProcessItem[newitemlist.size()]; // build the arrary ilist = newitemlist.toArray(ilist); try { // save all the new/modified objects to the repository destprocessItemClient.save(ilist, null); } catch (Exception ex) { if (!ex.getMessage().contains("Duplicate")) System.out.println("exception=" + ex.getMessage()); } |