Program: 65138
Project: 65138
Buggy source:
public Object valueFromRow(AbstractRecord row,JoinedAttributeManager joinManager,ObjectBuildingQuery sourceQuery,CacheKey cacheKey,AbstractSession executionSession,boolean isTargetProtected,Boolean[] wasCacheUsed) throws DatabaseException {
  List<XMLEntry> values=((DOMRecord)row).getValuesIndicatingNoEntry(this.getFields());
  Object container=getContainerPolicy().containerInstance(values.size());
  for (  XMLEntry next : values) {
    XMLField valueField=next.getXMLField();
    DatabaseMapping nextMapping=(DatabaseMapping)this.choiceElementMappings.get(valueField);
    Converter converter=getConverter();
    if (nextMapping.isAbstractCompositeCollectionMapping()) {
      XMLCompositeCollectionMapping xmlMapping=(XMLCompositeCollectionMapping)nextMapping;
      Object value=xmlMapping.buildObjectFromNestedRow((AbstractRecord)next.getValue(),joinManager,sourceQuery,executionSession,isTargetProtected);
      if (converter != null) {
        if (converter instanceof XMLConverter) {
          value=((XMLConverter)converter).convertDataValueToObjectValue(value,executionSession,((XMLRecord)row).getUnmarshaller());
        }
 else {
          value=converter.convertDataValueToObjectValue(value,executionSession);
        }
      }
      getContainerPolicy().addInto(value,container,executionSession);
    }
 else     if (nextMapping instanceof XMLCompositeDirectCollectionMapping) {
      XMLCompositeDirectCollectionMapping xmlMapping=(XMLCompositeDirectCollectionMapping)nextMapping;
      Object value=next.getValue();
      if (converter != null) {
        if (converter instanceof XMLConverter) {
          value=((XMLConverter)converter).convertDataValueToObjectValue(value,executionSession,((XMLRecord)row).getUnmarshaller());
        }
 else {
          value=converter.convertDataValueToObjectValue(value,executionSession);
        }
      }
      getContainerPolicy().addInto(value,container,executionSession);
    }
  }
  ArrayList<XMLMapping> processedMappings=new ArrayList<XMLMapping>();
  for (  XMLMapping mapping : choiceElementMappings.values()) {
    if (((DatabaseMapping)mapping).isObjectReferenceMapping() && !(processedMappings.contains(mapping))) {
      ((DatabaseMapping)mapping).readFromRowIntoObject(row,joinManager,((XMLRecord)row).getCurrentObject(),cacheKey,sourceQuery,executionSession,isTargetProtected);
      processedMappings.add(mapping);
    }
  }
  return container;
}

Fixed version (ground truth):
public Object valueFromRow(AbstractRecord row,JoinedAttributeManager joinManager,ObjectBuildingQuery sourceQuery,CacheKey cacheKey,AbstractSession executionSession,boolean isTargetProtected,Boolean[] wasCacheUsed) throws DatabaseException {
  List<XMLEntry> values=((DOMRecord)row).getValuesIndicatingNoEntry(this.getFields());
  Object container=getContainerPolicy().containerInstance(values.size());
  for (  XMLEntry next : values) {
    XMLField valueField=next.getXMLField();
    DatabaseMapping nextMapping=(DatabaseMapping)this.choiceElementMappings.get(valueField);
    Converter converter=getConverter();
    if (nextMapping.isAbstractCompositeCollectionMapping()) {
      XMLCompositeCollectionMapping xmlMapping=(XMLCompositeCollectionMapping)nextMapping;
      Object value=xmlMapping.buildObjectFromNestedRow((AbstractRecord)next.getValue(),joinManager,sourceQuery,executionSession,isTargetProtected);
      if (converter != null) {
        if (converter instanceof XMLConverter) {
          value=((XMLConverter)converter).convertDataValueToObjectValue(value,executionSession,((XMLRecord)row).getUnmarshaller());
        }
 else {
          value=converter.convertDataValueToObjectValue(value,executionSession);
        }
      }
      getContainerPolicy().addInto(value,container,executionSession);
    }
 else     if (nextMapping instanceof XMLCompositeDirectCollectionMapping) {
      XMLCompositeDirectCollectionMapping xmlMapping=(XMLCompositeDirectCollectionMapping)nextMapping;
      Object value=next.getValue();
      if (converter != null) {
        if (converter instanceof XMLConverter) {
          value=((XMLConverter)converter).convertDataValueToObjectValue(value,executionSession,((XMLRecord)row).getUnmarshaller());
        }
 else {
          value=converter.convertDataValueToObjectValue(value,executionSession);
        }
      }
      getContainerPolicy().addInto(value,container,executionSession);
    }
  }
  ArrayList<XMLMapping> processedMappings=new ArrayList<XMLMapping>();
  for (  XMLMapping mapping : choiceElementMappings.values()) {
    if (((DatabaseMapping)mapping).isObjectReferenceMapping() && ((DatabaseMapping)mapping).isCollectionMapping() && !(processedMappings.contains(mapping))) {
      ((XMLCollectionReferenceMapping)mapping).readFromRowIntoObject(row,joinManager,((XMLRecord)row).getCurrentObject(),cacheKey,sourceQuery,executionSession,isTargetProtected,container);
      processedMappings.add(mapping);
    }
  }
  return container;
}