It's all about the answers!

Ask a question

how to solve ImmutablePropertyException exception on setting setCurrentIteration


vinitha dsouza (14723136) | asked Mar 10 '17, 2:44 a.m.
edited Mar 10 '17, 2:45 a.m.

Hello  team

 I am using the below code to set the currentiteration for the timeine  :
 IDevelopmentLineHandle[] developmentLineHandle = prjArea
                .getDevelopmentLines();
 developmentLine = fAuditableClient.resolveAuditable(developmentLineHandle1,
         ItemProfile.DEVELOPMENT_LINE_DEFAULT, monitor);

for (IIterationHandle subiterationsHandle : subiterations) {
                IIteration subiteration = fAuditableClient.resolveAuditable(
                        subiterationsHandle, ItemProfile.ITERATION_DEFAULT, monitor); }
         
developmentLine.setCurrentIteration(subiterationsHandle);

i get the below error:

Exception in thread "main" com.ibm.team.repository.common.internal.ImmutablePropertyException
    at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2143)
    at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
    at com.ibm.team.process.internal.common.impl.DevelopmentLineImpl.setInternalCurrentIteration(DevelopmentLineImpl.java:766)
    at com.ibm.team.process.internal.common.impl.DevelopmentLineImpl.setCurrentIteration(DevelopmentLineImpl.java:1286)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:597)
    at com.sun.proxy.$Proxy18.setCurrentIteration(Unknown Source)


Let me know hat is causing the problem here ????

Thank you
  

Accepted answer


permanent link
Ralph Schoon (63.4k33646) | answered Mar 10 '17, 2:57 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Mar 10 '17, 2:57 a.m.

 Please carefully read Understanding and Using the RTC Java Client API   especially the part about working copy. You can not just modify stuff, you usually need a modifiable item (working copy).


From the same blog post read up how to setup the RTC SDK and the plain java client libraries. Use the Eclipse Java Search capability to search for setCurrentIteration and look at how the code is used in the RTC SDK e.g. unit tests.

Example from com.ibm.team.process.internal.client.tests.AbstractTeamProcessTest.setCurrentIteration(IDevelopmentLine, String) to get the workingcopy (called mutable copy in this context)

   
            IProcessItemService service = getProcessItemService();
            line = (IDevelopmentLine) service.getMutableCopy(line);
            line.setCurrentIteration(current);
            service.save(line, null);
    



vinitha dsouza selected this answer as the correct answer

Comments
vinitha dsouza commented Mar 10 '17, 3:27 a.m.

Thank You for the reply :)
It worked


Ralph Schoon commented Mar 10 '17, 3:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The point of my reply was what to do and how to get at this information. It took me longer to type the response than to search for the API. If you want to continue with this kind of work, you should learn how to find API examples in the SDK.


You had several questions with a similar pattern and you would be able to answer most of your questions if you could do 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.