Program: 88940
Project: 88940
Buggy source:
@Transactional public void submitToWorkflow(String docId){
  Document doc=this._getDocument(docId);
  LOG.debug("String_Node_Str",doc.getId());
  UserDetails userDetails=this.userService.currentUser();
  if (!StringUtils.equals(userDetails.getUsername(),doc.getAuthor())) {
    throw new InvalidAccessException("String_Node_Str");
  }
  try {
    identityService.setAuthenticatedUserId(userDetails.getUsername());
    ProcessInstance current=workflowService.findProcessInstanceByBusinessKey(docId);
    if (current != null) {
      throw new IllegalStateException("String_Node_Str" + docId + "String_Node_Str");
    }
    DocType docType=doc.getDocType();
    String group=doc.getGroupId();
    ProcessDefinition procDef=this.workflowService.findProcDef(docType,group);
    if (procDef == null) {
      throw new IllegalArgumentException("String_Node_Str" + docType.name() + "String_Node_Str"+ group);
    }
    current=runtimeService.startProcessInstanceByKey(procDef.getKey(),docId);
    Task task=taskService.createTaskQuery().processInstanceId(current.getProcessInstanceId()).singleResult();
    taskService.setAssignee(task.getId(),userDetails.getUsername());
    taskService.setVariableLocal(task.getId(),"String_Node_Str","String_Node_Str");
    Map<String,Object> processVariables=Maps.newHashMap();
    processVariables.put("String_Node_Str",doc.getAuthor());
    processVariables.put("String_Node_Str",doc.getId());
    processVariables.put("String_Node_Str",doc.getAuthor());
    processVariables.put("String_Node_Str",doc.getDocType());
    taskService.setVariables(task.getId(),processVariables);
    taskService.complete(task.getId());
  }
  finally {
    identityService.setAuthenticatedUserId(null);
  }
}

Fixed version (ground truth):
@Transactional public void submitToWorkflow(String docId){
  Document doc=this._getDocument(docId);
  LOG.debug("String_Node_Str",doc.getId());
  UserDetails userDetails=this.userService.currentUser();
  if (!StringUtils.equals(userDetails.getUsername(),doc.getAuthor())) {
    throw new InvalidAccessException("String_Node_Str");
  }
  try {
    identityService.setAuthenticatedUserId(userDetails.getUsername());
    DocType docType=doc.getDocType();
    String group=doc.getGroupId();
    ProcessDefinition procDef=this.workflowService.findProcDef(docType,group);
    if (procDef == null) {
      throw new IllegalArgumentException("String_Node_Str" + docType.name() + "String_Node_Str"+ group);
    }
    ProcessInstance current=workflowService.findProcessInstanceByBusinessKey(docId);
    if (current == null) {
      current=runtimeService.startProcessInstanceByKey(procDef.getKey(),docId);
    }
    Task task=taskService.createTaskQuery().processInstanceId(current.getProcessInstanceId()).singleResult();
    taskService.setAssignee(task.getId(),userDetails.getUsername());
    taskService.setVariableLocal(task.getId(),"String_Node_Str","String_Node_Str");
    Map<String,Object> processVariables=Maps.newHashMap();
    processVariables.put("String_Node_Str",doc.getAuthor());
    processVariables.put("String_Node_Str",doc.getId());
    processVariables.put("String_Node_Str",doc.getAuthor());
    processVariables.put("String_Node_Str",doc.getDocType());
    taskService.setVariables(task.getId(),processVariables);
    taskService.complete(task.getId());
  }
  finally {
    identityService.setAuthenticatedUserId(null);
  }
}