Program: 79835
Project: 79835
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,headers="String_Node_Str") ConversationDTO requestProcessor(@RequestBody RfRequestDTO rfRequestDTO){
  Conversation existingConversation=null;
  Conversation currentConversation=null;
  if (rfRequestDTO == null) {
    return null;
  }
 else   if (rfRequestDTO.getId() != null && !rfRequestDTO.getId().isEmpty()) {
    RfRequest rfRequest=rfRequestRepository.findOne(rfRequestDTO.getId());
    String conversationId=rfRequest != null ? rfRequest.getConversationId() : null;
    existingConversation=conversationId != null ? conversationRepository.findOne(conversationId) : null;
    rfRequestDTO.setAssertionDTO(EntityToDTO.toDTO(rfRequest.getAssertion()));
  }
  long startTime=System.currentTimeMillis();
  RfResponseDTO result=genericHandler.processHttpRequest(rfRequestDTO);
  long endTime=System.currentTimeMillis();
  long duration=endTime - startTime;
  assertHandler.runAssert(result);
  currentConversation=ConversationConverter.convertToEntity(rfRequestDTO,result);
  if (existingConversation != null) {
    currentConversation.getRfRequest().setAssertion(existingConversation.getRfRequest().getAssertion());
  }
  rfRequestRepository.save(currentConversation.getRfRequest());
  rfResponseRepository.save(currentConversation.getRfResponse());
  currentConversation.setDuration(duration);
  Object principal=SecurityContextHolder.getContext().getAuthentication().getPrincipal();
  if (principal instanceof User) {
    currentConversation.setLastModifiedBy((User)principal);
  }
  currentConversation.setCreatedDate(new Date());
  currentConversation.setLastModifiedDate(new Date());
  try {
    currentConversation=conversationRepository.save(currentConversation);
    currentConversation.getRfRequest().setConversationId(currentConversation.getId());
    rfRequestRepository.save(currentConversation.getRfRequest());
    if (existingConversation != null && existingConversation.getNodeId() != null) {
      BaseNode node=nodeRepository.findOne(existingConversation.getNodeId());
      currentConversation.setNodeId(node.getId());
      node.setConversation(currentConversation);
      nodeRepository.save(node);
    }
    conversationRepository.save(currentConversation);
  }
 catch (  InvalidDataAccessResourceUsageException e) {
    throw new ApiException("String_Node_Str",e);
  }
  ConversationDTO conversationDTO=new ConversationDTO();
  conversationDTO.setDuration(duration);
  conversationDTO.setRfResponseDTO(result);
  result.setItemDTO(conversationDTO);
  return conversationDTO;
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,headers="String_Node_Str") ConversationDTO requestProcessor(@RequestBody RfRequestDTO rfRequestDTO){
  Conversation existingConversation=null;
  Conversation currentConversation=null;
  if (rfRequestDTO == null) {
    return null;
  }
 else   if (rfRequestDTO.getId() != null && !rfRequestDTO.getId().isEmpty()) {
    RfRequest rfRequest=rfRequestRepository.findOne(rfRequestDTO.getId());
    String conversationId=rfRequest != null ? rfRequest.getConversationId() : null;
    existingConversation=conversationId != null ? conversationRepository.findOne(conversationId) : null;
    existingConversation=existingConversation != null ? nodeRepository.findOne(existingConversation.getNodeId()).getConversation() : null;
    rfRequestDTO.setAssertionDTO(EntityToDTO.toDTO(existingConversation.getRfRequest().getAssertion()));
  }
  long startTime=System.currentTimeMillis();
  RfResponseDTO result=genericHandler.processHttpRequest(rfRequestDTO);
  long endTime=System.currentTimeMillis();
  long duration=endTime - startTime;
  assertHandler.runAssert(result);
  currentConversation=ConversationConverter.convertToEntity(rfRequestDTO,result);
  if (existingConversation != null) {
    currentConversation.getRfRequest().setAssertion(existingConversation.getRfRequest().getAssertion());
  }
  rfRequestRepository.save(currentConversation.getRfRequest());
  rfResponseRepository.save(currentConversation.getRfResponse());
  currentConversation.setDuration(duration);
  Object principal=SecurityContextHolder.getContext().getAuthentication().getPrincipal();
  if (principal instanceof User) {
    currentConversation.setLastModifiedBy((User)principal);
  }
  currentConversation.setCreatedDate(new Date());
  currentConversation.setLastModifiedDate(new Date());
  try {
    currentConversation=conversationRepository.save(currentConversation);
    currentConversation.getRfRequest().setConversationId(currentConversation.getId());
    rfRequestRepository.save(currentConversation.getRfRequest());
    if (existingConversation != null && existingConversation.getNodeId() != null) {
      BaseNode node=nodeRepository.findOne(existingConversation.getNodeId());
      currentConversation.setNodeId(node.getId());
      node.setConversation(currentConversation);
      nodeRepository.save(node);
    }
    conversationRepository.save(currentConversation);
  }
 catch (  InvalidDataAccessResourceUsageException e) {
    throw new ApiException("String_Node_Str",e);
  }
  ConversationDTO conversationDTO=new ConversationDTO();
  conversationDTO.setDuration(duration);
  conversationDTO.setRfResponseDTO(result);
  result.setItemDTO(conversationDTO);
  return conversationDTO;
}