Program: 69620
Project: 69620
Buggy source:
protected void showMessages(UserRequest ureq,UserInfo selectedInfo){
  vcThreadView=createVelocityContainer("String_Node_Str");
  vcThreadView.contextPut("String_Node_Str",selectedInfo.getFirstName());
  vcThreadView.contextPut("String_Node_Str",selectedInfo.getLastName());
  vcThreadView.contextPut("String_Node_Str",Boolean.FALSE);
  vcThreadView.contextPut("String_Node_Str",Boolean.FALSE);
  vcThreadView.contextPut("String_Node_Str",Boolean.FALSE);
  vcThreadView.contextPut("String_Node_Str",Boolean.FALSE);
  vcThreadView.contextPut("String_Node_Str",null);
  threadMsgs=getMessages(selectedInfo.getIdentity());
  currentMessagesMap=new ArrayList<Map<String,Object>>(threadMsgs.size());
  MarkingService markingService=(MarkingService)CoreSpringFactory.getBean(MarkingService.class);
  List<String> markResSubPath=new ArrayList<String>();
  for (  Message threadMsg : threadMsgs) {
    markResSubPath.add(threadMsg.getKey().toString());
  }
  List<Mark> markList=markingService.getMarkManager().getMarks(forumOres,ureq.getIdentity(),markResSubPath);
  Map<String,Mark> marks=new HashMap<String,Mark>(markList.size() * 2 + 1);
  for (  Mark mark : markList) {
    marks.put(mark.getResSubPath(),mark);
  }
  List<MarkResourceStat> statList=markingService.getMarkManager().getStats(forumOres,markResSubPath,null);
  Map<String,MarkResourceStat> stats=new HashMap<String,MarkResourceStat>(statList.size() * 2 + 1);
  for (  MarkResourceStat stat : statList) {
    stats.put(stat.getSubPath(),stat);
  }
  List<Message> orderedMessages=new ArrayList<Message>();
  orderedMessages.addAll(threadMsgs);
  orderedMessages=threadMsgs;
  Collections.sort(orderedMessages,new MessageComparatorByDate());
  int msgNum=0;
  for (  Message msg : orderedMessages) {
    addMessageToCurrentMessagesAndVC(ureq,msg,vcThreadView,currentMessagesMap,msgNum++,marks,stats);
  }
  vcThreadView.contextPut("String_Node_Str",currentMessagesMap);
  vcThreadView.contextPut("String_Node_Str",new SearchForumCallback());
  searchPanel.setContent(vcThreadView);
}

Fixed version (ground truth):
protected void showMessages(UserRequest ureq,UserInfo selectedInfo){
  vcThreadView=createVelocityContainer("String_Node_Str");
  vcThreadView.contextPut("String_Node_Str",selectedInfo.getFirstName());
  vcThreadView.contextPut("String_Node_Str",selectedInfo.getLastName());
  vcThreadView.contextPut("String_Node_Str",Boolean.FALSE);
  vcThreadView.contextPut("String_Node_Str",Boolean.FALSE);
  vcThreadView.contextPut("String_Node_Str",Boolean.FALSE);
  vcThreadView.contextPut("String_Node_Str",Boolean.FALSE);
  vcThreadView.contextPut("String_Node_Str",null);
  threadMsgs=getMessages(selectedInfo.getIdentity());
  currentMessagesMap=new ArrayList<Map<String,Object>>(threadMsgs.size());
  MarkingService markingService=(MarkingService)CoreSpringFactory.getBean(MarkingService.class);
  List<String> markResSubPath=new ArrayList<String>();
  for (  Message threadMsg : threadMsgs) {
    markResSubPath.add(threadMsg.getKey().toString());
  }
  List<Mark> markList=markingService.getMarkManager().getMarks(forumOres,ureq.getIdentity(),markResSubPath);
  Map<String,Mark> marks=new HashMap<String,Mark>(markList.size() * 2 + 1);
  for (  Mark mark : markList) {
    marks.put(mark.getResSubPath(),mark);
  }
  List<MarkResourceStat> statList=markingService.getMarkManager().getStats(forumOres,markResSubPath,null);
  Map<String,MarkResourceStat> stats=new HashMap<String,MarkResourceStat>(statList.size() * 2 + 1);
  for (  MarkResourceStat stat : statList) {
    stats.put(stat.getSubPath(),stat);
  }
  List<Message> orderedMessages=new ArrayList<Message>();
  orderedMessages.addAll(threadMsgs);
  orderedMessages=threadMsgs;
  Collections.sort(orderedMessages,new MessageComparatorByDate());
  int msgNum=0;
  for (  Message msg : orderedMessages) {
    addMessageToCurrentMessagesAndVC(ureq,msg,vcThreadView,currentMessagesMap,msgNum++,marks,stats);
  }
  vcThreadView.contextPut("String_Node_Str",currentMessagesMap);
  vcThreadView.contextPut("String_Node_Str",thumbMapper);
  vcThreadView.contextPut("String_Node_Str",new SearchForumCallback());
  searchPanel.setContent(vcThreadView);
}