It's all about the answers!

Ask a question

ConcurrentModificationException in IWorkItem.setValue


Geoff Alexander (19623947) | asked May 29 '12, 3:24 p.m.
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.

4 answers



permanent link
Tim Hahn (511) | answered May 31 '12, 10:56 a.m.
JAZZ DEVELOPER
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.

permanent link
VK L (8177154159) | answered May 30 '12, 10:19 p.m.
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.

permanent link
Geoff Alexander (19623947) | answered May 30 '12, 12:29 p.m.
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." );
}
}

permanent link
VK L (8177154159) | answered May 30 '12, 1:07 a.m.
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.

Your answer


Register or to post your answer.