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

ConcurrentModificationException in IWorkItem.setValue

We have a user that's encountering a java.util.ConcurrentModificationException in an IWorkItem.setValue call in our standalone Java application. Here's the stack trace:

Throwable occurred: java.lang.UnsupportedOperationException: Failed to create/update work item
at com.ibm.ArtifactTechnology.ABS.performers.RTC.UpdateAction.processArtifact(UpdateAction.java:93)
at com.ibm.ArtifactTechnology.ABS.performers.RTC.UpdateAction.performAction(UpdateAction.java:61)
at com.ibm.ArtifactTechnology.ABS.ArtifactBroker.performers.common.ActionPerformerBase.performAction(ActionPerformerBase.java:183)
at com.ibm.ArtifactTechnology.ABS.ArtifactBroker.ArtifactBroker.performAction(ArtifactBroker.java:682)
at com.ibm.ArtifactTechnology.ABS.ArtifactBroker.ArtifactBroker.broker(ArtifactBroker.java:601)
at com.ibm.ArtifactTechnology.ABS.ArtifactBridge.ArtifactBridge.broker(ArtifactBridge.java:467)
at com.ibm.ArtifactTechnology.ABS.ArtifactBridge.ArtifactBridge.bridge(ArtifactBridge.java:386)
at com.ibm.ArtifactTechnology.ABS.ArtifactBridge.ArtifactBridge.bridge(ArtifactBridge.java:555)
at com.ibm.ArtifactTechnology.ABS.ArtifactBridge.ArtifactBridge.poll(ArtifactBridge.java:245)
at com.ibm.ArtifactTechnology.ABS.ArtifactBroker.PollNotifier$PollDispatcher.run(PollNotifier.java:59)
Caused by: java.util.ConcurrentModificationException
at org.eclipse.emf.common.util.AbstractEList$EIterator.checkModCount(AbstractEList.java:762)
at org.eclipse.emf.common.util.AbstractEList$EIterator.doNext(AbstractEList.java:710)
at org.eclipse.emf.common.util.AbstractEList$EIterator.next(AbstractEList.java:696)
at org.eclipse.emf.common.util.BasicEMap.ensureEntryDataExists(BasicEMap.java:245)
at org.eclipse.emf.common.util.BasicEMap.put(BasicEMap.java:575)
at org.eclipse.emf.common.util.BasicEMap$DelegatingMap.put(BasicEMap.java:799)
at com.ibm.team.repository.common.model.impl.ItemImpl.setLargeStringExtension(ItemImpl.java:1301)
at com.ibm.team.workitem.common.internal.model.impl.WorkItemImpl.setValue(WorkItemImpl.java:2927)
at com.ibm.ArtifactTechnology.ABS.performers.RTC.UpdateAction.setValue(UpdateAction.java:507)
at com.ibm.ArtifactTechnology.ABS.performers.RTC.UpdateAction.fieldsToWorkItem(UpdateAction.java:243)
at com.ibm.ArtifactTechnology.ABS.performers.RTC.UpdateAction.modifyWorkItem(UpdateAction.java:206)
at com.ibm.ArtifactTechnology.ABS.performers.RTC.UpdateAction.createOrUpdateWorkItem(UpdateAction.java:191)
at com.ibm.ArtifactTechnology.ABS.performers.RTC.UpdateAction.recordToWorkItem(UpdateAction.java:155)
at com.ibm.ArtifactTechnology.ABS.performers.RTC.UpdateAction.createWorkItem(UpdateAction.java:108)
at com.ibm.ArtifactTechnology.ABS.performers.RTC.UpdateAction.processArtifact(UpdateAction.java:88)
... 9 more


Does anyone know what might be causing this exception? Or can someone at least give me some hints as what to look at in debugging this problem. I'm pretty sure that our code doesn't make concurrent updates to the IWorkItem.

0 votes



4 answers

Permanent link
Hi Geoff,
What are the action performed in the code? please paste the code here. All the users are getting this error while performing similar actions - is it a repeating error?

Thanks.

0 votes


Permanent link
I've only seen this problem in one user's environment; no other user has reported it, and I'm unable to reproduce it in my local environment.

Our Java application is a long running application that periodically polls (queries) an external data repository for new and changed data and creates and updates custom work items in RTC with this data. Our custom work items contain dozens of attributes. Here's the code that updates the work item attributes:

   protected void fieldsToWorkItem( ArtifactRecordPart rec, IWorkItem workItem )

throws TeamRepositoryException
{
for (ArtifactRecordField field : rec.getFields())
{
IAttribute attr = getWorkItemClient().findAttribute(
getProjectArea(), field.getName(), null );
if (attr != null)
{
if (!ignoreFieldForUpdate( attr ))
{
this.setValue( workItem, attr, rec, field );
}
}
else
{
Log.defLogWarning( "Couldn't find attribute named "
+ field.getName() );
}
}
}

private void setValue( IWorkItem workItem, IAttribute attribute,
ArtifactRecordPart rec, ArtifactRecordField field )
throws TeamRepositoryException
{
Object rtcValue = this
.toValidRTCValue( workItem, attribute, rec, field );

if (rtcValue != null)
{
try
{
Log.defLogDebug( "Setting " + attribute.getIdentifier() + " to "
+ rtcValue );
workItem.setValue( attribute, rtcValue );
}
catch (ImmutablePropertyException e)
{
// do nothing, Rational doesn't seem to honor
// isReadOnly() sometimes for fields that are
// indeed read-only.
}
}
else
{
Log.defLogWarning( "Attribute named " + field.getName()
+ " could not be converted to an RTC type." );
}
}

0 votes


Permanent link
Is this error repeating for that particular user atleast? (or) was it the only 1 time he faced it?
If it was only once, could have been some attribute's particular change would have caused it.

Thanks.

0 votes


Permanent link
Since the call to setValue() is inside of a loop, could it be that the same attribute is attempted to be set multiple times within the same loop? While this would really be a sequential update to the same attribute value, if there is some flag or something that tries to restrict modification of an attribute until after a save has been done, this could explain it.

I don't know the internal rules for setValue() though - whether multiple sequential calls to setValue() for the same attribute are supposed to work or not.

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,937

Question asked: May 29 '12, 3:24 p.m.

Question was seen: 6,282 times

Last updated: May 29 '12, 3:24 p.m.

Confirmation Cancel Confirm