Program: 65497
Project: 65497
Buggy source:
public void initializeRecord(XMLMapping selfRecordMapping) throws SAXException {
  try {
    XMLDescriptor xmlDescriptor=(XMLDescriptor)treeObjectBuilder.getDescriptor();
    if (xmlDescriptor.isSequencedObject()) {
      unmarshalContext=new SequencedUnmarshalContext();
    }
 else {
      unmarshalContext=ObjectUnmarshalContext.getInstance();
    }
    Object object=this.xmlReader.getCurrentObject(session,selfRecordMapping);
    if (object == null) {
      object=treeObjectBuilder.buildNewInstance();
    }
    this.setCurrentObject(object);
    if (getParentRecord() != null && getParentRecord().getDocumentLocator() != null) {
      this.documentLocator=getParentRecord().getDocumentLocator();
    }
    if (documentLocator != null) {
      if (xmlDescriptor.getLocationAccessor() != null) {
        setXmlLocation(new Locator2Impl(documentLocator));
      }
    }
    XMLUnmarshalListener xmlUnmarshalListener=unmarshaller.getUnmarshalListener();
    if (null != xmlUnmarshalListener) {
      if (null == this.parentRecord) {
        xmlUnmarshalListener.beforeUnmarshal(object,null);
      }
 else {
        xmlUnmarshalListener.beforeUnmarshal(object,parentRecord.getCurrentObject());
      }
    }
    if (null == parentRecord) {
      this.xmlReader.newObjectEvent(object,null,selfRecordMapping);
    }
 else {
      this.xmlReader.newObjectEvent(object,parentRecord.getCurrentObject(),selfRecordMapping);
    }
    List containerValues=treeObjectBuilder.getContainerValues();
    if (null != containerValues) {
      List choiceContainerValues=treeObjectBuilder.getChoiceContainerValues();
      if (choiceContainerValues != null) {
        containerInstances=new Object[containerValues.size() + choiceContainerValues.size()];
      }
 else {
        containerInstances=new Object[containerValues.size()];
      }
      for (int x=0, containerValuesSize=containerValues.size(); x < containerValuesSize; x++) {
        ContainerValue containerValue=(ContainerValue)containerValues.get(x);
        if (containerValue.getReuseContainer() && !(containerValue.getMapping().getAttributeAccessor().isReadOnly())) {
          getContainerInstance(containerValue,false);
        }
        if (containerValue.isDefaultEmptyContainer()) {
          getContainerInstance(containerValue,true);
        }
      }
    }
    if (null != xPathNode.getSelfChildren()) {
      int selfChildrenSize=xPathNode.getSelfChildren().size();
      selfRecords=new ArrayList<UnmarshalRecord>(selfChildrenSize);
      for (int x=0; x < selfChildrenSize; x++) {
        XPathNode selfNode=xPathNode.getSelfChildren().get(x);
        if (null != selfNode.getNodeValue()) {
          selfRecords.add(selfNode.getNodeValue().buildSelfRecord(this,attributes));
        }
      }
    }
  }
 catch (  EclipseLinkException e) {
    if (null == xmlReader.getErrorHandler()) {
      throw e;
    }
 else {
      SAXParseException saxParseException=new SAXParseException(null,null,null,0,0,e);
      xmlReader.getErrorHandler().error(saxParseException);
    }
  }
}

Fixed version (ground truth):
public void initializeRecord(XMLMapping selfRecordMapping) throws SAXException {
  try {
    XMLDescriptor xmlDescriptor=(XMLDescriptor)treeObjectBuilder.getDescriptor();
    if (xmlDescriptor.isSequencedObject()) {
      unmarshalContext=new SequencedUnmarshalContext();
    }
 else {
      unmarshalContext=ObjectUnmarshalContext.getInstance();
    }
    Object object=this.xmlReader.getCurrentObject(session,selfRecordMapping);
    if (object == null) {
      object=treeObjectBuilder.buildNewInstance();
    }
    this.setCurrentObject(object);
    if (getParentRecord() != null && getParentRecord().getDocumentLocator() != null) {
      this.documentLocator=getParentRecord().getDocumentLocator();
    }
    if (documentLocator != null) {
      if (xmlDescriptor.getLocationAccessor() != null) {
        setXmlLocation(new Locator2Impl(documentLocator));
      }
    }
    XMLUnmarshalListener xmlUnmarshalListener=unmarshaller.getUnmarshalListener();
    if (null != xmlUnmarshalListener) {
      if (null == this.parentRecord) {
        xmlUnmarshalListener.beforeUnmarshal(object,null);
      }
 else {
        xmlUnmarshalListener.beforeUnmarshal(object,parentRecord.getCurrentObject());
      }
    }
    if (null == parentRecord) {
      this.xmlReader.newObjectEvent(object,null,selfRecordMapping);
    }
 else {
      this.xmlReader.newObjectEvent(object,parentRecord.getCurrentObject(),selfRecordMapping);
    }
    List containerValues=treeObjectBuilder.getContainerValues();
    if (null != containerValues) {
      containerInstances=new Object[containerValues.size()];
      for (int x=0, containerValuesSize=containerValues.size(); x < containerValuesSize; x++) {
        ContainerValue containerValue=(ContainerValue)containerValues.get(x);
        if (containerValue.getReuseContainer() && !(containerValue.getMapping().getAttributeAccessor().isReadOnly())) {
          getContainerInstance(containerValue,false);
        }
        if (containerValue.isDefaultEmptyContainer()) {
          getContainerInstance(containerValue,true);
        }
      }
    }
    if (null != xPathNode.getSelfChildren()) {
      int selfChildrenSize=xPathNode.getSelfChildren().size();
      selfRecords=new ArrayList<UnmarshalRecord>(selfChildrenSize);
      for (int x=0; x < selfChildrenSize; x++) {
        XPathNode selfNode=xPathNode.getSelfChildren().get(x);
        if (null != selfNode.getNodeValue()) {
          selfRecords.add(selfNode.getNodeValue().buildSelfRecord(this,attributes));
        }
      }
    }
  }
 catch (  EclipseLinkException e) {
    if (null == xmlReader.getErrorHandler()) {
      throw e;
    }
 else {
      SAXParseException saxParseException=new SAXParseException(null,null,null,0,0,e);
      xmlReader.getErrorHandler().error(saxParseException);
    }
  }
}