Program: 63059
Project: 63059
Buggy source:
private Set<CandidateEntity> generateCandidates(KnowledgeBase aKB,String aMention){
  if (aMention == null || aMention.isEmpty()) {
    return Collections.emptySet();
  }
  if (candidateCache.containsKey(aMention)) {
    return candidateCache.get(aMention);
  }
  Set<CandidateEntity> candidates=new HashSet<>();
  List<String> mentionArray=Arrays.asList(aMention.split("String_Node_Str"));
  mentionArray=mentionArray.stream().filter(m -> !punctuations.contains(m)).collect(Collectors.toList());
  if (stopwords != null) {
    if (mentionArray.stream().allMatch(m -> stopwords.contains(m))) {
      logger.error("String_Node_Str",aMention);
      return Collections.emptySet();
    }
  }
  if (mentionArray.isEmpty()) {
    logger.error("String_Node_Str");
    return Collections.emptySet();
  }
  try (RepositoryConnection conn=kbService.getConnection(aKB)){
    TupleQuery query=QueryUtil.generateCandidateQuery(conn,mentionArray,properties.getCandidateQueryLimit(),aKB.getDescriptionIri());
    try (TupleQueryResult entityResult=query.evaluate()){
      while (entityResult.hasNext()) {
        BindingSet solution=entityResult.next();
        Value e2=solution.getValue("String_Node_Str");
        Value label=solution.getValue("String_Node_Str");
        Value altLabel=solution.getValue("String_Node_Str");
        Value description=solution.getValue("String_Node_Str");
        CandidateEntity newEntity=new CandidateEntity((e2 != null) ? e2.stringValue() : "String_Node_Str",(label != null) ? label.stringValue() : "String_Node_Str",(altLabel != null) ? altLabel.stringValue() : "String_Node_Str",(description != null) ? description.stringValue() : "String_Node_Str");
        candidates.add(newEntity);
      }
    }
   }
   if (candidates.isEmpty()) {
    String[] split=aMention.split("String_Node_Str");
    if (split.length > 1) {
      for (      String s : split) {
        candidates.addAll(generateCandidates(aKB,s));
      }
    }
  }
  candidateCache.put(aMention,candidates);
  return candidates;
}

Fixed version (ground truth):
private Set<CandidateEntity> generateCandidates(KnowledgeBase aKB,String aMention){
  if (aMention == null || aMention.isEmpty()) {
    return Collections.emptySet();
  }
  if (candidateCache.containsKey(aMention)) {
    return candidateCache.get(aMention);
  }
  Set<CandidateEntity> candidates=new HashSet<>();
  List<String> mentionList=Arrays.asList(aMention.split("String_Node_Str"));
  mentionList=mentionList.stream().map(m -> m.replaceAll("String_Node_Str","String_Node_Str")).collect(Collectors.toList());
  if (stopwords != null) {
    if (stopwords.containsAll(mentionList)) {
      logger.error("String_Node_Str",aMention);
      return Collections.emptySet();
    }
  }
  String processedMention=String.join("String_Node_Str",mentionList);
  if (processedMention.isEmpty()) {
    logger.error("String_Node_Str");
    return Collections.emptySet();
  }
  try (RepositoryConnection conn=kbService.getConnection(aKB)){
    TupleQuery query=QueryUtil.generateCandidateQuery(conn,processedMention,properties.getCandidateQueryLimit(),aKB.getDescriptionIri());
    try (TupleQueryResult entityResult=query.evaluate()){
      while (entityResult.hasNext()) {
        BindingSet solution=entityResult.next();
        Value e2=solution.getValue("String_Node_Str");
        Value label=solution.getValue("String_Node_Str");
        Value altLabel=solution.getValue("String_Node_Str");
        Value description=solution.getValue("String_Node_Str");
        CandidateEntity newEntity=new CandidateEntity((e2 != null) ? e2.stringValue() : "String_Node_Str",(label != null) ? label.stringValue() : "String_Node_Str",(altLabel != null) ? altLabel.stringValue() : "String_Node_Str",(description != null) ? description.stringValue() : "String_Node_Str");
        candidates.add(newEntity);
      }
    }
   }
 catch (  QueryEvaluationException e) {
    logger.error("String_Node_Str",e);
  }
  if (candidates.isEmpty()) {
    String[] split=processedMention.split("String_Node_Str");
    if (split.length > 1) {
      for (      String s : split) {
        candidates.addAll(generateCandidates(aKB,s));
      }
    }
  }
  candidateCache.put(processedMention,candidates);
  return candidates;
}