Program: 172080
Project: 172080
Buggy source:
public WorkflowTask updateTask(String taskId,Map<QName,Serializable> properties,Map<QName,List<NodeRef>> add,Map<QName,List<NodeRef>> remove){
  String engineId=BPMEngineRegistry.getEngineId(taskId);
  TaskComponent component=getTaskComponent(engineId);
  String originalAsignee=(String)component.getTaskById(taskId).getProperties().get(ContentModel.PROP_OWNER);
  WorkflowTask task=component.updateTask(taskId,properties,add,remove);
  if (add != null && add.containsKey(WorkflowModel.ASSOC_PACKAGE)) {
    WorkflowInstance instance=task.getPath().getInstance();
    workflowPackageComponent.setWorkflowForPackage(instance);
  }
  String assignee=(String)properties.get(ContentModel.PROP_OWNER);
  if (assignee != null && assignee.length() != 0) {
    if (!assignee.equals(originalAsignee)) {
      String instanceId=task.getPath().getInstance().getId();
      WorkflowTask startTask=component.getStartTask(instanceId);
      if (startTask != null) {
        Boolean sendEMailNotification=(Boolean)startTask.getProperties().get(WorkflowModel.PROP_SEND_EMAIL_NOTIFICATIONS);
        if (Boolean.TRUE.equals(sendEMailNotification) == true) {
          String workflowDefId=task.getPath().getInstance().getDefinition().getName();
          if (workflowDefId.indexOf('$') != -1 && (workflowDefId.indexOf('$') < workflowDefId.length() - 1)) {
            workflowDefId=workflowDefId.substring(workflowDefId.indexOf('$') + 1);
          }
          String taskDefId=task.getDefinition().getId().replace("String_Node_Str","String_Node_Str");
          String taskType=workflowDefId + "String_Node_Str" + (engineId.equals(JBPMEngine.ENGINE_ID) ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ taskDefId;
          workflowNotificationUtils.sendWorkflowAssignedNotificationEMail(taskId,taskType,assignee,false);
        }
      }
    }
  }
  return task;
}

Fixed version (ground truth):
public WorkflowTask updateTask(String taskId,Map<QName,Serializable> properties,Map<QName,List<NodeRef>> add,Map<QName,List<NodeRef>> remove){
  String engineId=BPMEngineRegistry.getEngineId(taskId);
  TaskComponent component=getTaskComponent(engineId);
  String originalAsignee=(String)component.getTaskById(taskId).getProperties().get(ContentModel.PROP_OWNER);
  WorkflowTask task=component.updateTask(taskId,properties,add,remove);
  if (add != null && add.containsKey(WorkflowModel.ASSOC_PACKAGE)) {
    WorkflowInstance instance=task.getPath().getInstance();
    workflowPackageComponent.setWorkflowForPackage(instance);
  }
  String assignee=(String)properties.get(ContentModel.PROP_OWNER);
  if (assignee != null && assignee.length() != 0) {
    if (!assignee.equals(originalAsignee)) {
      String instanceId=task.getPath().getInstance().getId();
      WorkflowTask startTask=component.getStartTask(instanceId);
      if (startTask != null) {
        Boolean sendEMailNotification=(Boolean)startTask.getProperties().get(WorkflowModel.PROP_SEND_EMAIL_NOTIFICATIONS);
        if (Boolean.TRUE.equals(sendEMailNotification) == true) {
          String workflowDefId=task.getPath().getInstance().getDefinition().getName();
          if (workflowDefId.indexOf('$') != -1 && (workflowDefId.indexOf('$') < workflowDefId.length() - 1)) {
            workflowDefId=workflowDefId.substring(workflowDefId.indexOf('$') + 1);
          }
          workflowNotificationUtils.sendWorkflowAssignedNotificationEMail(taskId,null,assignee,false);
        }
      }
    }
  }
  return task;
}