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

Why do I get an assertion failed when getting an attribute value using the Java API?

Hi guys,

I would like to understanding an error that I'm getting.
I have a custom workitem type on my RTC instance, and I have an java application that read the workitem attributes and connect to an ERP system to perform some actions. I've noticed that If I have some workitems already created and I add a new custom attribute on the workitem configuration, the java application tries to find it on these already created workitems an return "assertion failed" stack trace. For new workitems I don't have this erros. If I delete these "old' workitems and create new ones, I don't have this problem as well

My question is: How can I manage this behavior? Imagine I have many workitems already cretead and I need to update or add a new custom attribute, I cannot delete and create all workitems again, it is not viable.

Should I have to create some pre-define custom workitems attributes and reserve them for future use avoiding creating new attributes?

Thank you in advance




0 votes

Comments

attributes are a PROJECT wide thing.. any workitem COULD have one of the attributes. In addition, adding attributes after workitems are created does NOT automatically force those attributesonto the old workitems. (you need to synchronize the old workitems to do this)

as Ralph mentions, there is a method to determine IF a workitem has that attributes

boolean IWorkItem.hasAttibute(IAttribute);



One answer

Permanent link
If you want to read an attribute use hasAttribute() first and only try to getValue, if there is one. See https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/

You can also, in the Eclipse admin when creating the new attribute check for its usage and thus Synchronize the attributes ti the old items. Anyway, always safer to check if it has the attribute, before trying to load it.

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

Question asked: Jun 21 '15, 9:43 a.m.

Question was seen: 4,880 times

Last updated: Jun 21 '15, 10:50 a.m.

Confirmation Cancel Confirm