Program: 154942
Project: 154942
Buggy source:
private void populateNodeRelEvent(PrimitiveElement element,TransactionDataImpl result){
  for (  int nodeId : element.nodes.keySet()) {
    CowNodeElement nodeElement=element.nodes.get(nodeId);
    NodeProxy node=new NodeProxy(nodeId,nodeManager);
    NodeImpl nodeImpl=nodeManager.getNodeForProxy(nodeId);
    if (nodeElement.relationshipAddMap != null) {
      for (      String type : nodeElement.relationshipAddMap.keySet()) {
        IntArray createdRels=nodeElement.relationshipAddMap.get(type);
        for (int i=0; i < createdRels.length(); i++) {
          int relId=createdRels.get(i);
          CowRelElement relElement=element.relationships.get(relId);
          if (relElement != null && relElement.deleted) {
            continue;
          }
          RelationshipProxy rel=new RelationshipProxy(relId,nodeManager);
          if (rel.getStartNode().getId() == nodeId) {
            result.created(new RelationshipProxy(relId,nodeManager));
          }
        }
      }
    }
    if (nodeElement.relationshipRemoveMap != null) {
      for (      String type : nodeElement.relationshipRemoveMap.keySet()) {
        IntArray deletedRels=nodeElement.relationshipRemoveMap.get(type);
        for (int i=0; i < deletedRels.length(); i++) {
          int relId=deletedRels.get(i);
          if (nodeManager.relCreated(relId)) {
            continue;
          }
          RelationshipProxy rel=new RelationshipProxy(relId,nodeManager);
          if (rel.getStartNode().getId() == nodeId) {
            result.deleted(new RelationshipProxy(relId,nodeManager));
          }
        }
      }
    }
    if (nodeElement.deleted) {
      if (nodeManager.nodeCreated(nodeId)) {
        continue;
      }
      result.deleted(node);
      List<PropertyEventData> props=nodeImpl.getAllCommittedProperties();
      for (      PropertyEventData data : props) {
        result.removedProperty(node,data.getKey(),data.getValue());
      }
    }
 else {
      if (nodeElement.propertyAddMap != null) {
        for (        PropertyData data : nodeElement.propertyAddMap.values()) {
          String key=nodeManager.getKeyForProperty(data.getId());
          Object oldValue=nodeImpl.getCommittedPropertyValue(key);
          Object newValue=data.getValue();
          result.assignedProperty(node,key,newValue,oldValue);
        }
      }
      if (nodeElement.propertyRemoveMap != null) {
        for (        PropertyData data : nodeElement.propertyRemoveMap.values()) {
          String key=nodeManager.getKeyForProperty(data.getId());
          Object oldValue=nodeImpl.getCommittedPropertyValue(key);
          result.removedProperty(node,key,oldValue);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void populateNodeRelEvent(PrimitiveElement element,TransactionDataImpl result){
  for (  int nodeId : element.nodes.keySet()) {
    CowNodeElement nodeElement=element.nodes.get(nodeId);
    NodeProxy node=new NodeProxy(nodeId,nodeManager);
    NodeImpl nodeImpl=nodeManager.getNodeForProxy(nodeId);
    if (nodeElement.deleted) {
      if (nodeManager.nodeCreated(nodeId)) {
        continue;
      }
      result.deleted(node);
    }
    if (nodeElement.relationshipAddMap != null && !nodeElement.deleted) {
      for (      String type : nodeElement.relationshipAddMap.keySet()) {
        IntArray createdRels=nodeElement.relationshipAddMap.get(type);
        for (int i=0; i < createdRels.length(); i++) {
          int relId=createdRels.get(i);
          CowRelElement relElement=element.relationships.get(relId);
          if (relElement != null && relElement.deleted) {
            continue;
          }
          RelationshipProxy rel=new RelationshipProxy(relId,nodeManager);
          if (rel.getStartNode().getId() == nodeId) {
            result.created(new RelationshipProxy(relId,nodeManager));
          }
        }
      }
    }
    if (nodeElement.relationshipRemoveMap != null) {
      for (      String type : nodeElement.relationshipRemoveMap.keySet()) {
        IntArray deletedRels=nodeElement.relationshipRemoveMap.get(type);
        for (int i=0; i < deletedRels.length(); i++) {
          int relId=deletedRels.get(i);
          if (nodeManager.relCreated(relId)) {
            continue;
          }
          RelationshipProxy rel=new RelationshipProxy(relId,nodeManager);
          if (rel.getStartNode().getId() == nodeId) {
            result.deleted(new RelationshipProxy(relId,nodeManager));
          }
        }
      }
    }
    if (nodeElement.propertyAddMap != null && !nodeElement.deleted) {
      for (      PropertyData data : nodeElement.propertyAddMap.values()) {
        String key=nodeManager.getKeyForProperty(data.getId());
        Object oldValue=nodeImpl.getCommittedPropertyValue(key);
        Object newValue=data.getValue();
        result.assignedProperty(node,key,newValue,oldValue);
      }
    }
    if (nodeElement.propertyRemoveMap != null) {
      for (      PropertyData data : nodeElement.propertyRemoveMap.values()) {
        String key=nodeManager.getKeyForProperty(data.getId());
        Object oldValue=data.getValue();
        if (oldValue == null && !nodeElement.deleted) {
          nodeImpl.getCommittedPropertyValue(key);
        }
        result.removedProperty(node,key,oldValue);
      }
    }
  }
}