It's all about the answers!

Ask a question

Help tagging a build


Steve Woodruff (5132) | asked Nov 23 '11, 11:18 a.m.
Hi,

I want to apply a tag to specific builds. I am able to get the IBuildResult handle but when I try to do setTags(), I get an exception:


IBuildResult buildResult = (IBuildResult) result;
if(buildResult.getLabel().equals("20111123-1018")) {
buildResult.setTags("steve-test");



Caused by: com.ibm.team.repository.common.internal.ImmutablePropertyException
at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2026)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
at com.ibm.team.build.internal.common.model.impl.BuildResultImpl.setTags(BuildResultImpl.java:1021)



Is there a different way I should be doing this?

Thanks,

-Steve

2 answers



permanent link
Steve Woodruff (5132) | answered Nov 23 '11, 1:55 p.m.
Duh. Needed to get a workingCopy of the buildResult. Now its fine.

For sake of sharing ...

IBuildResult buildResult = (IBuildResult) buildResult.getWorkingCopy();
String existing_tags = buildResult.getTags();
buildResult.setTags("" + existing_tags + " " + tag);
buildClient.save(buildResult, monitor);


-Steve

permanent link
Nick Edgar (6.5k711) | answered Dec 01 '11, 11:24 p.m.
JAZZ DEVELOPER
Yup, looks good, except that the tags should be comma-separated.

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.