Program: 68474
Project: 68474
Buggy source:
public void endDocument() throws SAXException {
  Object object=this.getCurrentObject();
  if (null != selfRecords) {
    int selfRecordsSize=selfRecords.size();
    for (int x=0; x < selfRecordsSize; x++) {
      ((UnmarshalRecord)selfRecords.get(x)).endDocument();
    }
  }
  try {
    if (null != containersMap) {
      Iterator containersMapKeys=containersMap.keySet().iterator();
      ContainerValue containerValue;
      Object containerInstance;
      while (containersMapKeys.hasNext()) {
        containerValue=(ContainerValue)containersMapKeys.next();
        containerInstance=containersMap.get(containerValue);
        containerValue.setContainerInstance(object,containerInstance);
      }
    }
    if (null != getNullCapableValues()) {
      int nullValuesSize=getNullCapableValues().size();
      NullCapableValue nullCapableValue;
      for (int x=0; x < nullValuesSize; x++) {
        nullCapableValue=(NullCapableValue)getNullCapableValues().get(x);
        nullCapableValue.setNullValue(object,session);
      }
    }
    List transformationMappings=treeObjectBuilder.getTransformationMappings();
    if (null != transformationMappings) {
      ReadObjectQuery query=new ReadObjectQuery();
      query.setSession(session);
      int transformationMappingsSize=transformationMappings.size();
      AbstractTransformationMapping transformationMapping;
      for (int x=0; x < transformationMappingsSize; x++) {
        transformationMapping=(AbstractTransformationMapping)transformationMappings.get(x);
        transformationMapping.readFromRowIntoObject(transformationRecord,null,object,query,session);
      }
    }
    if ((this.unmarshaller != null) && (unmarshaller.getUnmarshalListener() != null)) {
      if (this.parentRecord != null) {
        unmarshaller.getUnmarshalListener().afterUnmarshal(object,parentRecord.getCurrentObject());
      }
 else {
        unmarshaller.getUnmarshalListener().afterUnmarshal(object,null);
      }
    }
  }
 catch (  EclipseLinkException e) {
    if (null == xmlReader.getErrorHandler()) {
      throw e;
    }
 else {
      SAXParseException saxParseException=new SAXParseException(null,null,null,0,0,e);
      xmlReader.getErrorHandler().error(saxParseException);
    }
  }
  if (session.isUnitOfWork()) {
    XMLDescriptor xmlDescriptor=(XMLDescriptor)session.getDescriptor(object);
    if ((xmlDescriptor != null) && (xmlDescriptor.getPrimaryKeyFieldNames().size() > 0)) {
      Vector pk=treeObjectBuilder.extractPrimaryKeyFromObject(object,session);
      CacheKey key=session.getIdentityMapAccessorInstance().acquireDeferredLock(pk,xmlDescriptor.getJavaClass(),xmlDescriptor);
      key.setRecord(this);
      key.setObject(object);
      key.releaseDeferredLock();
    }
  }
}

Fixed version (ground truth):
public void endDocument() throws SAXException {
  Object object=this.getCurrentObject();
  if (null != selfRecords) {
    int selfRecordsSize=selfRecords.size();
    for (int x=0; x < selfRecordsSize; x++) {
      ((UnmarshalRecord)selfRecords.get(x)).endDocument();
    }
  }
  try {
    if (null != containersMap) {
      Iterator containersMapKeys=containersMap.keySet().iterator();
      ContainerValue containerValue;
      Object containerInstance;
      while (containersMapKeys.hasNext()) {
        containerValue=(ContainerValue)containersMapKeys.next();
        containerInstance=containersMap.get(containerValue);
        containerValue.setContainerInstance(object,containerInstance);
      }
    }
    if (null != getNullCapableValues()) {
      int nullValuesSize=getNullCapableValues().size();
      NullCapableValue nullCapableValue;
      for (int x=0; x < nullValuesSize; x++) {
        nullCapableValue=(NullCapableValue)getNullCapableValues().get(x);
        nullCapableValue.setNullValue(object,session);
      }
    }
    List transformationMappings=treeObjectBuilder.getTransformationMappings();
    if (null != transformationMappings) {
      ReadObjectQuery query=new ReadObjectQuery();
      query.setSession(session);
      int transformationMappingsSize=transformationMappings.size();
      AbstractTransformationMapping transformationMapping;
      for (int x=0; x < transformationMappingsSize; x++) {
        transformationMapping=(AbstractTransformationMapping)transformationMappings.get(x);
        transformationMapping.readFromRowIntoObject(transformationRecord,null,object,query,session);
      }
    }
    if ((this.unmarshaller != null) && (unmarshaller.getUnmarshalListener() != null)) {
      if (this.parentRecord != null) {
        unmarshaller.getUnmarshalListener().afterUnmarshal(object,parentRecord.getCurrentObject());
      }
 else {
        unmarshaller.getUnmarshalListener().afterUnmarshal(object,null);
      }
    }
    XMLDescriptor xmlDescriptor=(XMLDescriptor)session.getDescriptor(object);
    if ((xmlDescriptor != null) && (xmlDescriptor.getEventManager().hasAnyEventListeners())) {
      DescriptorEvent event=new DescriptorEvent(object);
      event.setSession(session);
      event.setRecord(this);
      event.setEventCode(DescriptorEventManager.PostBuildEvent);
      xmlDescriptor.getEventManager().executeEvent(event);
    }
  }
 catch (  EclipseLinkException e) {
    if (null == xmlReader.getErrorHandler()) {
      throw e;
    }
 else {
      SAXParseException saxParseException=new SAXParseException(null,null,null,0,0,e);
      xmlReader.getErrorHandler().error(saxParseException);
    }
  }
  if (session.isUnitOfWork()) {
    XMLDescriptor xmlDescriptor=(XMLDescriptor)session.getDescriptor(object);
    if ((xmlDescriptor != null) && (xmlDescriptor.getPrimaryKeyFieldNames().size() > 0)) {
      Vector pk=treeObjectBuilder.extractPrimaryKeyFromObject(object,session);
      CacheKey key=session.getIdentityMapAccessorInstance().acquireDeferredLock(pk,xmlDescriptor.getJavaClass(),xmlDescriptor);
      key.setRecord(this);
      key.setObject(object);
      key.releaseDeferredLock();
    }
  }
}