nus-yam/ex-repair huggingface dataset:
Program: 88947
Project: 88947
Buggy source:
@Test public void testGetDynamicTasks(){
  String key=WFConstants.createProcId(DocType.BOOK_REPORT,"String_Node_Str");
  ProcessDefinition processDefinition=this.repositoryService.createProcessDefinitionQuery().processDefinitionCategory(WFConstants.NAMESPACE_CATEGORY).processDefinitionKey(key).latestVersion().singleResult();
  assertNotNull(processDefinition);
  List<DynamicUserTask> dynamicTasks=this.workflowBldr.getDynamicTasks(processDefinition);
  LOG.debug(dynamicTasks.size());
  assertTrue(dynamicTasks.size() == 4);
  assertTrue(dynamicTasks.get(0).getId().startsWith(WFConstants.TASK_ID_DOC_COLLABORATE));
  assertTrue(dynamicTasks.get(1).getId().startsWith(WFConstants.TASK_ID_DOC_COLLABORATE));
  assertTrue(dynamicTasks.get(2).getId().startsWith(WFConstants.TASK_ID_DOC_APPROVAL));
  assertTrue(dynamicTasks.get(3).getId().startsWith(WFConstants.TASK_ID_DOC_APPROVAL));
}

Fixed version (ground truth):
@Test @DirtiesContext public void testGetDynamicTasks(){
  String key=WFConstants.createProcId(DocType.BOOK_REPORT,"String_Node_Str");
  ProcessDefinition processDefinition=this.repositoryService.createProcessDefinitionQuery().processDefinitionCategory(WFConstants.NAMESPACE_CATEGORY).processDefinitionKey(key).latestVersion().singleResult();
  assertNotNull(processDefinition);
  List<DynamicUserTask> dynamicTasks=this.workflowBldr.getDynamicTasks(processDefinition);
  LOG.debug(dynamicTasks.size());
  assertTrue(dynamicTasks.size() == 4);
  assertTrue(dynamicTasks.get(0).getId().startsWith(WFConstants.TASK_ID_DOC_COLLABORATE));
  assertTrue(dynamicTasks.get(1).getId().startsWith(WFConstants.TASK_ID_DOC_COLLABORATE));
  assertTrue(dynamicTasks.get(2).getId().startsWith(WFConstants.TASK_ID_DOC_APPROVAL));
  assertTrue(dynamicTasks.get(3).getId().startsWith(WFConstants.TASK_ID_DOC_APPROVAL));
}
Program: 88948
Project: 88948
Buggy source:
@Test public void testCreateGroupWorkflow() throws IOException {
  ProcessDefinition procDef=this.workflowBldr.createGroupWorkflow(DocType.BOOK_REPORT,"String_Node_Str");
  LOG.debug(procDef.getKey());
  assertNotNull(procDef);
  BpmnModel model=repositoryService.getBpmnModel(procDef.getId());
  assertNotNull(model);
  InputStream in=new DefaultProcessDiagramGenerator().generatePngDiagram(model);
  FileUtils.copyInputStreamToFile(in,new File("String_Node_Str"));
  IOUtils.closeQuietly(in);
  LOG.debug("String_Node_Str");
}

Fixed version (ground truth):
@Test @DirtiesContext public void testCreateGroupWorkflow() throws IOException {
  ProcessDefinition procDef=this.workflowBldr.createGroupWorkflow(DocType.BOOK_REPORT,"String_Node_Str");
  LOG.debug(procDef.getKey());
  assertNotNull(procDef);
  BpmnModel model=repositoryService.getBpmnModel(procDef.getId());
  assertNotNull(model);
  InputStream in=new DefaultProcessDiagramGenerator().generatePngDiagram(model);
  FileUtils.copyInputStreamToFile(in,new File("String_Node_Str"));
  IOUtils.closeQuietly(in);
  LOG.debug("String_Node_Str");
}
Program: 88949
Project: 88949
Buggy source:
@Transactional(readOnly=true) public Document getDocument(String id){
  return null;
}

Fixed version (ground truth):
@Transactional(readOnly=true) public Document getDocument(String id){
  return this._getDocument(id);
}
Program: 88950
Project: 88950
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.DELETE,produces=MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Response> acknowledgeAlert(@PathVariable("String_Node_Str") String alertId){
  log.debug("String_Node_Str",alertId);
  this.alertService.acknowledgeAlert(alertId,this.currentUserName());
  Response res=new Response(true,"String_Node_Str");
  return new ResponseEntity<Response>(res,HttpStatus.OK);
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.DELETE,produces=MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Response> acknowledgeAlert(@PathVariable("String_Node_Str") String alertId){
  LOG.debug("String_Node_Str",alertId);
  this.alertService.acknowledgeAlert(alertId,this.currentUserName());
  Response res=new Response(true,"String_Node_Str");
  return new ResponseEntity<Response>(res,HttpStatus.OK);
}
Program: 88951
Project: 88951
Buggy source:
/** 
 * @param userId
 * @return a list of alerts, sorted ascending by creation date, for a given user.Only the actual user him/herself can obtain his/her own alerts
 */
public List<Alert> readActiveAlertsByUser(String userId){
  log.debug("String_Node_Str",userId);
  UserDetails user=this.userService.currentUser();
  if (!StringUtils.equals(user.getUsername(),userId)) {
    throw new InvalidAccessException("String_Node_Str");
  }
  return this.alertDao.readActiveAlertsByUserId(userId);
}

Fixed version (ground truth):
/** 
 * @param userId
 * @return a list of alerts, sorted ascending by creation date, for a given user.Only the actual user him/herself can obtain his/her own alerts
 */
@Transactional(readOnly=true) public List<Alert> readActiveAlertsByUser(String userId){
  LOG.debug("String_Node_Str",userId);
  UserDetails user=this.userService.currentUser();
  if (!StringUtils.equals(user.getUsername(),userId)) {
    throw new InvalidAccessException("String_Node_Str");
  }
  return this.alertDao.readActiveAlertsByUserId(userId);
}
Program: 88952
Project: 88952
Buggy source:
/** 
 * Send an alert using the general <em>System User</em> as the sender
 * @param to
 * @param priority
 * @param message
 * @return
 */
public String sendSystemAlert(String to,int priority,String message){
  log.debug("String_Node_Str",to,priority);
  Alert alert=new Alert();
  alert.setCreatedBy(UserService.SYSTEM_USER);
  alert.setPriority(priority);
  alert.setCreatedDate(new Date());
  alert.setUserId(to);
  alert.setAcknowledged(Boolean.FALSE);
  alert.setMessage(message);
  return this.alertDao.create(alert);
}

Fixed version (ground truth):
/** 
 * Send an alert using the general <em>System User</em> as the sender
 * @param to
 * @param priority
 * @param message
 * @return id of new alert
 */
@Transactional public String sendSystemAlert(String to,int priority,String message){
  LOG.debug("String_Node_Str",to,priority);
  Alert alert=new Alert();
  alert.setCreatedBy(UserService.SYSTEM_USER);
  alert.setPriority(priority);
  alert.setCreatedDate(new Date());
  alert.setUserId(to);
  alert.setAcknowledged(Boolean.FALSE);
  alert.setMessage(message);
  return this.alertDao.create(alert);
}
Program: 88953
Project: 88953
Buggy source:
public void acknowledgeAlert(String alertId,String userId){
  log.debug("String_Node_Str",alertId,userId);
  Alert alert=this.alertDao.read(alertId);
  if (!StringUtils.equals(userId,alert.getUserId())) {
    throw new InvalidAccessException("String_Node_Str");
  }
  alert.setAcknowledged(Boolean.TRUE);
  this.alertDao.update(alert);
}

Fixed version (ground truth):
@Transactional public void acknowledgeAlert(String alertId,String userId){
  LOG.debug("String_Node_Str",alertId,userId);
  Alert alert=this.alertDao.read(alertId);
  if (!StringUtils.equals(userId,alert.getUserId())) {
    throw new InvalidAccessException("String_Node_Str");
  }
  alert.setAcknowledged(Boolean.TRUE);
  this.alertDao.update(alert);
}
Program: 88954
Project: 88954
Buggy source:
/** 
 * Send an alert using the current logged in user as the sender
 * @param to
 * @param priority
 * @param message
 * @return
 */
public String sendAlert(String to,int priority,String message){
  log.debug("String_Node_Str",to,priority);
  Alert alert=new Alert();
  UserDetails from=this.userService.currentUser();
  alert.setCreatedBy(from.getUsername());
  alert.setPriority(priority);
  alert.setCreatedDate(new Date());
  alert.setUserId(to);
  alert.setAcknowledged(Boolean.FALSE);
  alert.setMessage(message);
  return this.alertDao.create(alert);
}

Fixed version (ground truth):
/** 
 * Send an alert using the current logged in user as the sender
 * @param to
 * @param priority
 * @param message
 * @return id of new alert
 */
@Transactional public String sendAlert(String to,int priority,String message){
  LOG.debug("String_Node_Str",to,priority);
  Alert alert=new Alert();
  UserDetails from=this.userService.currentUser();
  alert.setCreatedBy(from.getUsername());
  alert.setPriority(priority);
  alert.setCreatedDate(new Date());
  alert.setUserId(to);
  alert.setAcknowledged(Boolean.FALSE);
  alert.setMessage(message);
  return this.alertDao.create(alert);
}
Program: 88955
Project: 88955
Buggy source:
@Override @Transactional(readOnly=true) public Alert read(String alertId){
  String sql="String_Node_Str";
  Map<String,String> params=ImmutableMap.of("String_Node_Str",alertId);
  Alert alert=this.namedJdbcTemplate.queryForObject(sql,params,new AlertRowMapper());
  return alert;
}

Fixed version (ground truth):
@Override public Alert read(String alertId){
  String sql="String_Node_Str";
  Map<String,String> params=ImmutableMap.of("String_Node_Str",alertId);
  Alert alert=this.namedJdbcTemplate.queryForObject(sql,params,new AlertRowMapper());
  return alert;
}
Program: 88956
Project: 88956
Buggy source:
@Override @Transactional(readOnly=true) public List<Alert> readActiveAlertsByUserId(String userId){
  String sql="String_Node_Str";
  Map<String,String> params=ImmutableMap.of("String_Node_Str",userId);
  List<Alert> alerts=this.namedJdbcTemplate.query(sql,params,new AlertRowMapper());
  log.debug("String_Node_Str",alerts.size(),userId);
  return alerts;
}

Fixed version (ground truth):
@Override public List<Alert> readActiveAlertsByUserId(String userId){
  String sql="String_Node_Str";
  Map<String,String> params=ImmutableMap.of("String_Node_Str",userId);
  List<Alert> alerts=this.namedJdbcTemplate.query(sql,params,new AlertRowMapper());
  LOG.debug("String_Node_Str",alerts.size(),userId);
  return alerts;
}
Program: 88957
Project: 88957
Buggy source:
@Transactional @Override public void acknowledgeAlert(String alertId){
  String sql="String_Node_Str";
  Map<String,Boolean> params=ImmutableMap.of("String_Node_Str",Boolean.TRUE);
  int results=this.namedJdbcTemplate.update(sql,params);
  log.debug("String_Node_Str" + results + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void acknowledgeAlert(String alertId){
  String sql="String_Node_Str";
  Map<String,Boolean> params=ImmutableMap.of("String_Node_Str",Boolean.TRUE);
  int results=this.namedJdbcTemplate.update(sql,params);
  LOG.debug("String_Node_Str",results);
}
Program: 88958
Project: 88958
Buggy source:
@Override @Transactional public String create(Alert alert){
  log.debug("String_Node_Str" + alert);
  checkArgument(StringUtils.isBlank(alert.getId()),"String_Node_Str");
  String id=UUID.randomUUID().toString();
  alert.setId(id);
  String sql="String_Node_Str" + "String_Node_Str";
  BeanPropertySqlParameterSource source=new BeanPropertySqlParameterSource(alert);
  int results=this.namedJdbcTemplate.update(sql,source);
  log.debug("String_Node_Str" + results + "String_Node_Str");
  return id;
}

Fixed version (ground truth):
@Override @Transactional public String create(Alert alert){
  LOG.debug("String_Node_Str",alert);
  checkArgument(StringUtils.isBlank(alert.getId()),"String_Node_Str");
  String id=UUID.randomUUID().toString();
  alert.setId(id);
  String sql="String_Node_Str" + "String_Node_Str";
  BeanPropertySqlParameterSource source=new BeanPropertySqlParameterSource(alert);
  int results=this.namedJdbcTemplate.update(sql,source);
  LOG.debug("String_Node_Str",results);
  return id;
}
Program: 88959
Project: 88959
Buggy source:
@Override @Transactional public void update(Alert alert){
  checkArgument(StringUtils.isNotBlank(alert.getId()),"String_Node_Str");
  String sql="String_Node_Str" + "String_Node_Str";
  BeanPropertySqlParameterSource source=new BeanPropertySqlParameterSource(alert);
  int results=this.namedJdbcTemplate.update(sql,source);
  log.debug("String_Node_Str" + results + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void update(Alert alert){
  checkArgument(StringUtils.isNotBlank(alert.getId()),"String_Node_Str");
  String sql="String_Node_Str" + "String_Node_Str";
  BeanPropertySqlParameterSource source=new BeanPropertySqlParameterSource(alert);
  int results=this.namedJdbcTemplate.update(sql,source);
  LOG.debug("String_Node_Str",results);
}
Program: 88960
Project: 88960
Buggy source:
@Override @Transactional(readOnly=true) public int getCount(){
  String sql="String_Node_Str";
  @SuppressWarnings("String_Node_Str") int count=this.namedJdbcTemplate.queryForObject(sql,Collections.EMPTY_MAP,Integer.class);
  log.debug("String_Node_Str" + count + "String_Node_Str");
  return count;
}

Fixed version (ground truth):
@Override public int getCount(){
  String sql="String_Node_Str";
  @SuppressWarnings("String_Node_Str") int count=this.namedJdbcTemplate.queryForObject(sql,Collections.EMPTY_MAP,Integer.class);
  LOG.debug("String_Node_Str",count);
  return count;
}
Program: 88961
Project: 88961
Buggy source:
@Override @Transactional public void delete(String alertId){
  String sql="String_Node_Str";
  Map<String,String> params=ImmutableMap.of("String_Node_Str",alertId);
  int deleted=this.namedJdbcTemplate.update(sql,params);
  log.debug("String_Node_Str" + deleted + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void delete(String alertId){
  String sql="String_Node_Str";
  Map<String,String> params=ImmutableMap.of("String_Node_Str",alertId);
  int deleted=this.namedJdbcTemplate.update(sql,params);
  LOG.debug("String_Node_Str",deleted);
}
Program: 88962
Project: 88962
Buggy source:
@Override @Transactional(readOnly=true) public List<Alert> readPage(PagingCriteria criteria){
  log.debug("String_Node_Str" + criteria);
  if (criteria == null || criteria.getLimit() == null || criteria.getStart() == null) {
    log.warn("String_Node_Str");
    return readAll();
  }
  String sql="String_Node_Str";
  BeanPropertySqlParameterSource source=new BeanPropertySqlParameterSource(criteria);
  List<Alert> alerts=this.namedJdbcTemplate.query(sql,source,new AlertRowMapper());
  log.debug(alerts.size() + "String_Node_Str" + criteria);
  return alerts;
}

Fixed version (ground truth):
@Override public List<Alert> readPage(PagingCriteria criteria){
  LOG.debug("String_Node_Str",criteria);
  if (criteria == null || criteria.getLimit() == null || criteria.getStart() == null) {
    LOG.warn("String_Node_Str");
    return readAll();
  }
  String sql="String_Node_Str";
  BeanPropertySqlParameterSource source=new BeanPropertySqlParameterSource(criteria);
  List<Alert> alerts=this.namedJdbcTemplate.query(sql,source,new AlertRowMapper());
  LOG.debug("String_Node_Str",alerts.size(),criteria);
  return alerts;
}
Program: 88963
Project: 88963
Buggy source:
@Override @Transactional(readOnly=true) public List<Alert> readAll(){
  String sql="String_Node_Str";
  List<Alert> alerts=this.namedJdbcTemplate.query(sql,new AlertRowMapper());
  log.debug("String_Node_Str" + alerts.size());
  return alerts;
}

Fixed version (ground truth):
@Override public List<Alert> readAll(){
  String sql="String_Node_Str";
  List<Alert> alerts=this.namedJdbcTemplate.query(sql,new AlertRowMapper());
  LOG.debug("String_Node_Str",alerts.size());
  return alerts;
}
Program: 88964
Project: 88964
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public String view(ModelMap model,@PathVariable(value="String_Node_Str") String id,final RedirectAttributes redirectAttributes,HttpServletRequest request){
  log.debug("String_Node_Str",id);
  Document doc=docService.getDocument(id);
  model.addAttribute("String_Node_Str",doc);
  List<HistoricTask> hts=this.localTaskSrvc.getDocApprovalHistory(id);
  model.addAttribute("String_Node_Str",hts);
  if (doc.getAuthor().equals(currentUserName()) && doc.isEditable()) {
    return "String_Node_Str";
  }
 else   if (doc.getAuthor().equals(currentUserName())) {
    model.addAttribute("String_Node_Str","String_Node_Str");
  }
 else {
    model.addAttribute("String_Node_Str","String_Node_Str");
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public String view(ModelMap model,@PathVariable(value="String_Node_Str") String id,final RedirectAttributes redirectAttributes,HttpServletRequest request){
  LOG.debug("String_Node_Str",id);
  Document doc=docService.getDocument(id);
  model.addAttribute("String_Node_Str",doc);
  List<HistoricTask> hts=this.localTaskSrvc.getTaskHistory(id);
  model.addAttribute("String_Node_Str",hts);
  if (doc.getAuthor().equals(currentUserName()) && doc.isEditable()) {
    return "String_Node_Str";
  }
 else   if (doc.getAuthor().equals(currentUserName())) {
    model.addAttribute("String_Node_Str","String_Node_Str");
  }
 else {
    model.addAttribute("String_Node_Str","String_Node_Str");
  }
  return "String_Node_Str";
}
Program: 88965
Project: 88965
Buggy source:
@RequestMapping(method=RequestMethod.POST) public String create(@Valid @ModelAttribute BookReport bookReport,BindingResult result,@RequestParam(required=false,value="String_Node_Str") boolean isSubmit,final RedirectAttributes redirectAttributes,HttpServletRequest request){
  log.debug("String_Node_Str",bookReport);
  if (result.hasErrors()) {
    return "String_Node_Str";
  }
  String docId=this.docService.createDocument(bookReport);
  if (isSubmit) {
    log.debug("String_Node_Str",docId);
    this.docService.submitToWorkflow(docId);
  }
  if (isSubmit) {
    redirectAttributes.addFlashAttribute("String_Node_Str","String_Node_Str" + "String_Node_Str");
  }
 else {
    redirectAttributes.addFlashAttribute("String_Node_Str","String_Node_Str");
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@RequestMapping(method=RequestMethod.POST) public String create(@Valid @ModelAttribute BookReport bookReport,BindingResult result,@RequestParam(required=false,value="String_Node_Str") boolean isSubmit,final RedirectAttributes redirectAttributes,HttpServletRequest request){
  LOG.debug("String_Node_Str",bookReport);
  if (result.hasErrors()) {
    return "String_Node_Str";
  }
  String docId=this.docService.createDocument(bookReport);
  if (isSubmit) {
    LOG.debug("String_Node_Str",docId);
    this.docService.submitToWorkflow(docId);
  }
  if (isSubmit) {
    redirectAttributes.addFlashAttribute("String_Node_Str","String_Node_Str" + "String_Node_Str");
  }
 else {
    redirectAttributes.addFlashAttribute("String_Node_Str","String_Node_Str");
  }
  return "String_Node_Str";
}
Program: 88966
Project: 88966
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) public String update(@Valid @ModelAttribute BookReport bookReport,BindingResult result,@RequestParam(required=false,value="String_Node_Str") boolean isSubmit,final RedirectAttributes redirectAttributes,HttpServletRequest request){
  log.debug("String_Node_Str",bookReport);
  if (!bookReport.isEditable()) {
    redirectAttributes.addFlashAttribute("String_Node_Str","String_Node_Str");
    return "String_Node_Str";
  }
  if (result.hasErrors()) {
    return "String_Node_Str";
  }
  this.docService.updateDocument(bookReport);
  String docId=bookReport.getId();
  if (isSubmit) {
    log.debug("String_Node_Str",docId);
    this.docService.submitToWorkflow(docId);
  }
  if (isSubmit) {
    redirectAttributes.addFlashAttribute("String_Node_Str","String_Node_Str" + "String_Node_Str");
  }
 else {
    redirectAttributes.addFlashAttribute("String_Node_Str","String_Node_Str");
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) public String update(@Valid @ModelAttribute BookReport bookReport,BindingResult result,@RequestParam(required=false,value="String_Node_Str") boolean isSubmit,final RedirectAttributes redirectAttributes,HttpServletRequest request){
  LOG.debug("String_Node_Str",bookReport);
  if (!bookReport.isEditable()) {
    redirectAttributes.addFlashAttribute("String_Node_Str","String_Node_Str");
    return "String_Node_Str";
  }
  if (result.hasErrors()) {
    return "String_Node_Str";
  }
  this.docService.updateDocument(bookReport);
  String docId=bookReport.getId();
  if (isSubmit) {
    LOG.debug("String_Node_Str",docId);
    this.docService.submitToWorkflow(docId);
  }
  if (isSubmit) {
    redirectAttributes.addFlashAttribute("String_Node_Str","String_Node_Str" + "String_Node_Str");
  }
 else {
    redirectAttributes.addFlashAttribute("String_Node_Str","String_Node_Str");
  }
  return "String_Node_Str";
}
Program: 88967
Project: 88967
Buggy source:
@Override public void validate(Object target,Errors errors){
  BookReport bookReport=(BookReport)target;
  log.debug("String_Node_Str",bookReport);
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Override public void validate(Object target,Errors errors){
  BookReport bookReport=(BookReport)target;
  LOG.debug("String_Node_Str",bookReport);
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmpty(errors,"String_Node_Str","String_Node_Str");
}
Program: 88968
Project: 88968
Buggy source:
public void submitForApproval(String docId){
  Document doc=this.docDao.read(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");
  }
  doc.setState(Document.STATE_WAITING_FOR_APPROVAL);
  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.getTitle());
  processVariables.put("String_Node_Str",doc.getAuthor());
  try {
    identityService.setAuthenticatedUserId(userDetails.getUsername());
    ProcessInstance current=this.getCurrentProcess(docId);
    if (current == null) {
      String key=Workflow.PROCESS_ID_DOC_APPROVAL;
      current=runtimeService.startProcessInstanceByKey(key,doc.getId());
    }
    Task task=taskService.createTaskQuery().processInstanceId(current.getProcessInstanceId()).singleResult();
    taskService.setAssignee(task.getId(),userDetails.getUsername());
    this.docDao.update(doc);
    taskService.setVariableLocal(task.getId(),"String_Node_Str","String_Node_Str");
    taskService.setVariables(task.getId(),processVariables);
    taskService.complete(task.getId());
  }
  finally {
    identityService.setAuthenticatedUserId(null);
  }
}

Fixed version (ground truth):
public void submitForApproval(String docId){
  Document doc=this.docDao.read(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");
  }
  doc.setState(Document.STATE_WAITING_FOR_APPROVAL);
  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.getTitle());
  processVariables.put("String_Node_Str",doc.getAuthor());
  try {
    identityService.setAuthenticatedUserId(userDetails.getUsername());
    ProcessInstance current=this.getCurrentProcess(docId);
    if (current == null) {
      String key=String.format("String_Node_Str",Workflow.PROCESS_ID_DOC_APPROVAL,doc.getGroupId());
      current=runtimeService.startProcessInstanceByKey(key,doc.getId());
    }
    Task task=taskService.createTaskQuery().processInstanceId(current.getProcessInstanceId()).singleResult();
    taskService.setAssignee(task.getId(),userDetails.getUsername());
    this.docDao.update(doc);
    taskService.setVariableLocal(task.getId(),"String_Node_Str","String_Node_Str");
    taskService.setVariables(task.getId(),processVariables);
    taskService.complete(task.getId());
  }
  finally {
    identityService.setAuthenticatedUserId(null);
  }
}
Program: 88969
Project: 88969
Buggy source:
@ModelAttribute public void addModelInfo(ModelMap model,HttpServletRequest request){
  super.addModelInfo(model,request);
  Authentication auth=(Authentication)request.getUserPrincipal();
  Set<String> authorities=AuthorityUtils.authorityListToSet(auth.getAuthorities());
  model.addAttribute("String_Node_Str",authorities);
  model.addAttribute("String_Node_Str",springContextListener.getAppContexts());
}

Fixed version (ground truth):
@ModelAttribute public void addModelInfo(ModelMap model,HttpServletRequest request){
  super.addModelInfo(model,request);
  Authentication auth=(Authentication)request.getUserPrincipal();
  Set<String> authorities=AuthorityUtils.authorityListToSet(auth.getAuthorities());
  model.addAttribute("String_Node_Str",authorities);
  model.addAttribute("String_Node_Str",springContextListener.getAppContexts());
  model.addAttribute("String_Node_Str",workflowService.getAllProcDefs(false));
}
Program: 88970
Project: 88970
Buggy source:
/** 
 * <p> This is a convenience method that will try for the most specific workflow (group and docType), but will fall back to just general docType if no group workflow exists.
 * @param docType
 * @return latest process definition for the given group and/or docType or null if neither (i.e. no group and also no docType) exits.
 */
public ProcessDefinition findProcDef(DocType docType,String group){
  log.debug("String_Node_Str",docType.name(),group);
  ProcessDefinition pd=this.findProcDefByDocTypeAndGroup(docType,group);
  if (pd == null) {
    log.debug("String_Node_Str",docType.name(),group);
    pd=this.findBaseProcDef(docType);
  }
  return pd;
}

Fixed version (ground truth):
/** 
 * <p/> This is a convenience method that will try for the most specific workflow (group and docType), but will fall back to just general docType if no group workflow exists.
 * @param docType
 * @return latest process definition for the given group and/or docType or null if neither (i.e. no group and also no docType) exits.
 */
public ProcessDefinition findProcDef(DocType docType,String group){
  ProcessDefinition pd=this.findProcDefByDocTypeAndGroup(docType,group);
  if (pd == null) {
    log.debug("String_Node_Str",docType.name(),group);
    pd=this.findBaseProcDef(docType);
  }
  return pd;
}
Program: 88971
Project: 88971
Buggy source:
public ProcessDefinition findBaseProcDef(DocType docType){
  log.debug("String_Node_Str",docType.name());
  String processIdStr=String.format("String_Node_Str",docType.name(),WFConstants.WORKFLOW_GROUP_NONE);
  ProcessDefinition pd=this.repoSrvc.createProcessDefinitionQuery().processDefinitionCategory(WFConstants.NAMESPACE_CATEGORY).processDefinitionKey(processIdStr).latestVersion().singleResult();
  return pd;
}

Fixed version (ground truth):
/** 
 * @param docType
 * @return the base workflow for a given document type (i.e. the process id of the process is {@code DocType_NONE}) or null if no base document exists.
 */
public ProcessDefinition findBaseProcDef(DocType docType){
  log.debug("String_Node_Str",docType.name());
  String processIdStr=String.format("String_Node_Str",docType.name(),WFConstants.WORKFLOW_GROUP_NONE);
  ProcessDefinition pd=this.repoSrvc.createProcessDefinitionQuery().processDefinitionCategory(WFConstants.NAMESPACE_CATEGORY).processDefinitionKey(processIdStr).latestVersion().singleResult();
  return pd;
}
Program: 88972
Project: 88972
Buggy source:
public void submitForApproval(String docId){
  Document doc=this.docDao.read(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");
  }
  doc.setState(Document.STATE_WAITING_FOR_APPROVAL);
  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.getTitle());
  processVariables.put("String_Node_Str",doc.getAuthor());
  try {
    identityService.setAuthenticatedUserId(userDetails.getUsername());
    ProcessInstance current=this.getCurrentProcess(docId);
    if (current == null) {
      current=runtimeService.startProcessInstanceByKey(Workflow.PROCESS_ID_DOC_APPROVAL,doc.getId(),processVariables);
    }
    Task task=taskService.createTaskQuery().processInstanceId(current.getProcessInstanceId()).singleResult();
    taskService.setAssignee(task.getId(),userDetails.getUsername());
    this.docDao.update(doc);
    taskService.setVariableLocal(task.getId(),"String_Node_Str","String_Node_Str");
    taskService.complete(task.getId());
  }
  finally {
    identityService.setAuthenticatedUserId(null);
  }
}

Fixed version (ground truth):
public void submitForApproval(String docId){
  Document doc=this.docDao.read(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");
  }
  doc.setState(Document.STATE_WAITING_FOR_APPROVAL);
  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.getTitle());
  processVariables.put("String_Node_Str",doc.getAuthor());
  try {
    identityService.setAuthenticatedUserId(userDetails.getUsername());
    ProcessInstance current=this.getCurrentProcess(docId);
    if (current == null) {
      current=runtimeService.startProcessInstanceByKey(Workflow.PROCESS_ID_DOC_APPROVAL,doc.getId());
    }
    Task task=taskService.createTaskQuery().processInstanceId(current.getProcessInstanceId()).singleResult();
    taskService.setAssignee(task.getId(),userDetails.getUsername());
    this.docDao.update(doc);
    taskService.setVariableLocal(task.getId(),"String_Node_Str","String_Node_Str");
    taskService.setVariables(task.getId(),processVariables);
    taskService.complete(task.getId());
  }
  finally {
    identityService.setAuthenticatedUserId(null);
  }
}
Program: 88973
Project: 88973
Buggy source:
/** 
 * Default authentication action.
 * @return Result
 */
public Result authenticate(){
  Form<Login> form=formFactory.form(Login.class).bindFromRequest();
  String username=form.field("String_Node_Str").value();
  String redirect=session().get("String_Node_Str");
  LOG.info("String_Node_Str" + username);
  if (username.contains("String_Node_Str")) {
    return emailAuthenticate(redirect);
  }
 else   if (username.length() == 0) {
    LOG.info("String_Node_Str");
    flash("String_Node_Str","String_Node_Str");
    return badRequest(landingpage.render(form));
  }
 else {
    return ldapAuthenticate(redirect);
  }
}

Fixed version (ground truth):
/** 
 * Default authentication action.
 * @return Result
 */
public Result authenticate(){
  Form<Login> form=formFactory.form(Login.class).bindFromRequest();
  String username=form.field("String_Node_Str").value();
  String redirect=session().get("String_Node_Str");
  LOG.info("String_Node_Str" + username);
  LOG.info("String_Node_Str" + redirect);
  if (username.contains("String_Node_Str")) {
    return emailAuthenticate(redirect);
  }
 else   if (username.length() == 0) {
    LOG.info("String_Node_Str");
    flash("String_Node_Str","String_Node_Str");
    return badRequest(landingpage.render(form));
  }
 else {
    return ldapAuthenticate(redirect);
  }
}
Program: 88974
Project: 88974
Buggy source:
/** 
 * Upload some media.
 * @param folderId Folder to upload.
 * @return Result
 */
@Transactional @SuppressWarnings("String_Node_Str") public Result upload(Long folderId){
  MultipartFormData body=request().body().asMultipartFormData();
  MultipartFormData.FilePart<File> upload=body.getFile("String_Node_Str");
  Folder folder=folderManager.findById(folderId);
  if (!Secured.viewFolder(folder)) {
    return forbidden("String_Node_Str");
  }
  if (upload != null) {
    if (mediaManager.byteAsMB(upload.getFile().length()) > MAX_FILESIZE) {
      return status(REQUEST_ENTITY_TOO_LARGE,"String_Node_Str" + MAX_FILESIZE + "String_Node_Str");
    }
    if (mediaManager.existsInFolder(upload.getFilename(),folder)) {
      return status(CONFLICT,"String_Node_Str");
    }
    Media med=new Media();
    med.title=upload.getFilename();
    med.mimetype=upload.getContentType();
    med.fileName=upload.getFilename();
    med.file=upload.getFile();
    med.owner=Component.currentAccount();
    med.folder=folder;
    med.temporarySender=Component.currentAccount();
    try {
      mediaManager.create(med);
      notificationService.createNotification(med,Media.MEDIA_NEW_MEDIA);
    }
 catch (    Exception e) {
      return internalServerError("String_Node_Str");
    }
    return created("String_Node_Str" + med.id);
  }
 else {
    return internalServerError("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Upload some media.
 * @param folderId Folder to upload.
 * @return Result
 */
@Transactional @SuppressWarnings("String_Node_Str") public Result upload(Long folderId){
  MultipartFormData body=request().body().asMultipartFormData();
  MultipartFormData.FilePart<File> upload=body.getFile("String_Node_Str");
  Folder folder=folderManager.findById(folderId);
  if (!Secured.viewFolder(folder)) {
    return forbidden("String_Node_Str");
  }
  if (upload != null) {
    if (mediaManager.byteAsMB(upload.getFile().length()) > MAX_FILESIZE) {
      return status(REQUEST_ENTITY_TOO_LARGE,"String_Node_Str" + MAX_FILESIZE + "String_Node_Str");
    }
    if (mediaManager.existsInFolder(upload.getFilename(),folder)) {
      return status(CONFLICT,"String_Node_Str");
    }
    Media med=new Media();
    med.title=upload.getFilename();
    med.mimetype=upload.getContentType();
    med.fileName=upload.getFilename();
    med.file=upload.getFile();
    med.owner=Component.currentAccount();
    med.folder=folder;
    med.temporarySender=Component.currentAccount();
    try {
      mediaManager.create(med);
      notificationService.createNotification(med,Media.MEDIA_NEW_MEDIA);
      LOG.info("String_Node_Str" + med.fileName + "String_Node_Str"+ med.owner.id+ "String_Node_Str"+ med.folder.id);
    }
 catch (    Exception e) {
      return internalServerError("String_Node_Str");
    }
    return created("String_Node_Str" + med.id);
  }
 else {
    return internalServerError("String_Node_Str");
  }
}
Program: 88975
Project: 88975
Buggy source:
/** 
 * Marks all notifications as read for an Account.
 * @return Result
 */
@Transactional public Result readAll(){
  notificationManager.markAllAsRead(Component.currentAccount());
  flash("String_Node_Str",messagesApi.get(Lang.defaultLang(),"String_Node_Str"));
  return redirect(request().getHeader("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Marks all notifications as read for an Account.
 * @return Result
 */
@Transactional public Result readAll(){
  notificationManager.markAllAsRead(Component.currentAccount());
  flash("String_Node_Str",messagesApi.get(Lang.defaultLang(),"String_Node_Str"));
  return Secured.nullRedirect(request());
}
Program: 88977
Project: 88977
Buggy source:
@Transactional public Result addComment(long postId){
  final Post parent=postManager.findById(postId);
  final Account account=Component.currentAccount();
  if (!Secured.addComment(parent)) {
    return badRequest();
  }
  final Form<Post> filledForm=postForm.bindFromRequest();
  if (filledForm.hasErrors()) {
    return badRequest();
  }
 else {
    final Post post=filledForm.get();
    post.owner=account;
    post.parent=parent;
    postManager.create(post);
    postManager.update(parent);
    if (postManager.belongsToGroup(parent)) {
      notificationService.createNotification(post,Post.COMMENT_GROUP);
    }
    if (postManager.belongsToAccount(parent)) {
      if (!account.equals(parent.owner) && !parent.account.equals(parent.owner)) {
        notificationService.createNotification(post,Post.COMMENT_OWN_PROFILE);
      }
 else       if (!account.equals(parent.account)) {
        notificationService.createNotification(post,Post.COMMENT_PROFILE);
      }
    }
    return ok(views.html.snippets.postComment.render(post));
  }
}

Fixed version (ground truth):
@Transactional public Result addComment(long postId){
  final Post parent=postManager.findById(postId);
  final Account account=Component.currentAccount();
  if (!Secured.addComment(parent)) {
    return badRequest();
  }
  final Form<Post> filledForm=postForm.bindFromRequest();
  if (filledForm.hasErrors()) {
    return badRequest();
  }
 else {
    final Post post=filledForm.get();
    post.owner=account;
    post.parent=parent;
    postManager.create(post);
    postManager.update(parent);
    if (postManager.belongsToGroup(parent)) {
      notificationService.createNotification(post,Post.COMMENT_GROUP);
    }
    if (postManager.belongsToAccount(parent)) {
      if (!account.equals(parent.owner) && !parent.account.equals(parent.owner)) {
        notificationService.createNotification(post,Post.COMMENT_OWN_PROFILE);
      }
 else       if (!account.equals(parent.account)) {
        notificationService.createNotification(post,Post.COMMENT_PROFILE);
      }
    }
    LOG.info("String_Node_Str" + post.owner.id + "String_Node_Str"+ post.parent.id);
    return ok(views.html.snippets.postComment.render(post));
  }
}
Program: 88978
Project: 88978
Buggy source:
public boolean isAccountValid(String email,String password){
  try {
    final Account result=(Account)JPA.em().createQuery("String_Node_Str").setParameter("String_Node_Str",email).getSingleResult();
    if (result != null && Component.md5(password).equals(result.password)) {
      return true;
    }
  }
 catch (  NoResultException exp) {
    return false;
  }
  return false;
}

Fixed version (ground truth):
public boolean isAccountValid(String email,String password){
  try {
    final Account result=(Account)jpaApi.em().createQuery("String_Node_Str").setParameter("String_Node_Str",email).getSingleResult();
    if (result != null && Component.md5(password).equals(result.password)) {
      return true;
    }
  }
 catch (  NoResultException exp) {
    return false;
  }
  return false;
}
Program: 88979
Project: 88979
Buggy source:
public Folder findById(long id){
  return JPA.em().find(Folder.class,id);
}

Fixed version (ground truth):
public Folder findById(long id){
  return jpaApi.em().find(Folder.class,id);
}
Program: 88980
Project: 88980
Buggy source:
@Override public void update(Object model){
  JPA.em().merge(model);
}

Fixed version (ground truth):
@Override public void update(Object model){
  jpaApi.em().merge(model);
}
Program: 88981
Project: 88981
Buggy source:
@Override public void delete(Object model){
  Folder folder=((Folder)model);
  if (!folder.folders.isEmpty()) {
    for (    Folder subFolder : folder.folders) {
      delete(subFolder);
    }
  }
  for (  Media media : folder.files) {
    mediaManager.delete(media);
  }
  JPA.em().remove(folder);
}

Fixed version (ground truth):
@Override public void delete(Object model){
  Folder folder=((Folder)model);
  if (!folder.folders.isEmpty()) {
    for (    Folder subFolder : folder.folders) {
      delete(subFolder);
    }
  }
  for (  Media media : folder.files) {
    mediaManager.delete(media);
  }
  jpaApi.em().remove(folder);
}
Program: 88982
Project: 88982
Buggy source:
/** 
 * Returns a notification by a reference ID and a recipient ID.
 * @param referenceId Reference ID
 * @param recipientId Recipient ID
 * @return Notification instance
 * @throws NoResultException
 */
public static Notification findByReferenceIdAndRecipientId(Long referenceId,Long recipientId) throws NoResultException {
  return JPA.em().createQuery("String_Node_Str",Notification.class).setParameter("String_Node_Str",referenceId).setParameter("String_Node_Str",recipientId).getSingleResult();
}

Fixed version (ground truth):
/** 
 * Returns a notification by a reference ID and a recipient ID.
 * @param referenceId Reference ID
 * @param recipientId Recipient ID
 * @return Notification instance
 * @throws NoResultException
 */
public static Notification findByReferenceIdAndRecipientId(Long referenceId,Long recipientId) throws NoResultException {
  return JPA.withTransaction(() -> {
    return JPA.em().createQuery("String_Node_Str",Notification.class).setParameter("String_Node_Str",referenceId).setParameter("String_Node_Str",recipientId).getSingleResult();
  }
);
}
Program: 88983
Project: 88983
Buggy source:
@Override public List<Account> getRecipients(){
  Folder rootFolder=FolderManager.findRoot(folder);
  List<Account> accounts=new ArrayList<>();
  if (rootFolder.group != null) {
    for (    GroupAccount groupAccount : rootFolder.group.groupAccounts) {
      if (groupAccount.linkType.equals(LinkType.establish)) {
        accounts.add(groupAccount.account);
      }
    }
  }
  return accounts;
}

Fixed version (ground truth):
@Override public List<Account> getRecipients(){
  return GroupAccountManager.findAccountsByGroup2(folder.group,LinkType.establish);
}
Program: 88984
Project: 88984
Buggy source:
public Result mediaList(Long folderId){
  Folder folder=folderManager.findById(folderId);
  if (!Secured.viewFolder(folder)) {
    return forbidden("String_Node_Str");
  }
  Folder rootFolder=FolderManager.findRoot(folder);
  List<Media> mediaSet=folder.files;
  List<Folder> folderList=folder.folders;
  return created(list.render(mediaSet,folderList,rootFolder.group.id));
}

Fixed version (ground truth):
public Result mediaList(Long folderId){
  Folder folder=folderManager.findById(folderId);
  if (!Secured.viewFolder(folder)) {
    return forbidden("String_Node_Str");
  }
  Folder rootFolder=FolderManager.findRoot(folder);
  List<Media> mediaSet=folder.files;
  List<Folder> folderList=folder.folders;
  return ok(list.render(mediaSet,folderList,rootFolder.group.id));
}
Program: 88985
Project: 88985
Buggy source:
/** 
 * Upload some media.
 * @param folderId Folder to upload.
 * @return Result
 */
@Transactional public Result upload(Long folderId){
  MultipartFormData body=request().body().asMultipartFormData();
  Http.MultipartFormData.FilePart upload=body.getFile("String_Node_Str");
  Folder folder=folderManager.findById(folderId);
  if (!Secured.viewFolder(folder)) {
    return forbidden("String_Node_Str");
  }
  if (upload != null) {
    if (mediaManager.byteAsMB(upload.getFile().length()) > MAX_FILESIZE) {
      return status(REQUEST_ENTITY_TOO_LARGE,"String_Node_Str" + MAX_FILESIZE + "String_Node_Str");
    }
    if (mediaManager.existsInFolder(upload.getFilename(),folder)) {
      return status(CONFLICT,"String_Node_Str");
    }
    Media med=new Media();
    med.title=upload.getFilename();
    med.mimetype=upload.getContentType();
    med.fileName=upload.getFilename();
    med.file=upload.getFile();
    med.owner=Component.currentAccount();
    med.folder=folder;
    med.temporarySender=Component.currentAccount();
    try {
      mediaManager.create(med);
      NotificationService.getInstance().createNotification(med,Media.MEDIA_NEW_MEDIA);
    }
 catch (    Exception e) {
      return internalServerError("String_Node_Str");
    }
    Folder rootFolder=FolderManager.findRoot(folder);
    List<Media> mediaSet=folder.files;
    List<Folder> folderList=folder.folders;
    return created(list.render(mediaSet,folderList,rootFolder.id));
  }
 else {
    return internalServerError("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Upload some media.
 * @param folderId Folder to upload.
 * @return Result
 */
@Transactional public Result upload(Long folderId){
  MultipartFormData body=request().body().asMultipartFormData();
  Http.MultipartFormData.FilePart upload=body.getFile("String_Node_Str");
  Folder folder=folderManager.findById(folderId);
  if (!Secured.viewFolder(folder)) {
    return forbidden("String_Node_Str");
  }
  if (upload != null) {
    if (mediaManager.byteAsMB(upload.getFile().length()) > MAX_FILESIZE) {
      return status(REQUEST_ENTITY_TOO_LARGE,"String_Node_Str" + MAX_FILESIZE + "String_Node_Str");
    }
    if (mediaManager.existsInFolder(upload.getFilename(),folder)) {
      return status(CONFLICT,"String_Node_Str");
    }
    Media med=new Media();
    med.title=upload.getFilename();
    med.mimetype=upload.getContentType();
    med.fileName=upload.getFilename();
    med.file=upload.getFile();
    med.owner=Component.currentAccount();
    med.folder=folder;
    med.temporarySender=Component.currentAccount();
    try {
      mediaManager.create(med);
      NotificationService.getInstance().createNotification(med,Media.MEDIA_NEW_MEDIA);
    }
 catch (    Exception e) {
      return internalServerError("String_Node_Str");
    }
    return created("String_Node_Str");
  }
 else {
    return internalServerError("String_Node_Str");
  }
}