Program: 69622
Project: 69622
Buggy source:
private void addMessageToCurrentMessagesAndVC(UserRequest ureq,Message m,VelocityContainer vcContainer,List<Map<String,Object>> allList,int msgCount,Map<String,Mark> marks,Map<String,MarkResourceStat> stats){
  Map<String,Object> map=new HashMap<String,Object>();
  map.put("String_Node_Str",m.getKey());
  if (rms.contains(m.getKey())) {
    map.put("String_Node_Str",Boolean.FALSE);
  }
 else {
    markRead(m,ureq.getIdentity());
    map.put("String_Node_Str",Boolean.TRUE);
  }
  Date creationDate=m.getCreationDate();
  Identity modifier=m.getModifier();
  if (modifier != null) {
    map.put("String_Node_Str",Boolean.TRUE);
    map.put("String_Node_Str",modifier.getUser().getProperty(UserConstants.FIRSTNAME,ureq.getLocale()));
    map.put("String_Node_Str",modifier.getUser().getProperty(UserConstants.LASTNAME,ureq.getLocale()));
  }
 else {
    map.put("String_Node_Str",Boolean.FALSE);
  }
  map.put("String_Node_Str",m.getTitle());
  map.put("String_Node_Str",m.getBody());
  map.put("String_Node_Str",f.formatDateAndTime(creationDate));
  Identity creator=m.getCreator();
  map.put("String_Node_Str",creator.getKey());
  map.put("String_Node_Str",Formatter.truncate(creator.getUser().getProperty(UserConstants.FIRSTNAME,ureq.getLocale()),18));
  map.put("String_Node_Str",Formatter.truncate(creator.getUser().getProperty(UserConstants.LASTNAME,ureq.getLocale()),18));
  map.put("String_Node_Str",f.formatDateAndTime(m.getLastModified()));
  OlatRootFolderImpl msgContainer=fm.getMessageContainer(forum.getKey(),m.getKey());
  map.put("String_Node_Str",msgContainer);
  final List<VFSItem> attachments=new ArrayList<VFSItem>(msgContainer.getItems(new VFSItemExcludePrefixFilter(MessageEditController.ATTACHMENT_EXCLUDE_PREFIXES)));
  map.put("String_Node_Str",attachments);
  if (attachments == null || attachments.size() == 0)   map.put("String_Node_Str",Boolean.FALSE);
 else   map.put("String_Node_Str",Boolean.TRUE);
  int numOfChildren;
  numOfChildren=countNumOfChildren(m,threadMsgs);
  Integer nOfCh=new Integer(numOfChildren);
  map.put("String_Node_Str",nOfCh);
  boolean userIsMsgCreator=ureq.getIdentity().getKey().equals(creator.getKey());
  Boolean uIsMsgC=new Boolean(userIsMsgCreator);
  map.put("String_Node_Str",uIsMsgC);
  boolean isThreadtop=m.getThreadtop() == null;
  map.put("String_Node_Str",Boolean.valueOf(isThreadtop));
  boolean isThreadClosed=Status.getStatus(m.getStatusCode()).isClosed();
  if (!isThreadtop) {
    isThreadClosed=Status.getStatus(m.getThreadtop().getStatusCode()).isClosed();
  }
  map.put("String_Node_Str",isThreadClosed);
  if (!isGuestOnly(ureq)) {
    DisplayPortraitController portrait=new DisplayPortraitController(ureq,getWindowControl(),m.getCreator(),true,true,false,true);
    map.put("String_Node_Str",portrait);
    String portraitComponentVCName=m.getKey().toString();
    map.put("String_Node_Str",portraitComponentVCName);
    vcContainer.put(portraitComponentVCName,portrait.getInitialComponent());
    Link vcLink=LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,UserManager.getInstance().getUserDisplayName(creator),Link.LINK_CUSTOM_CSS + Link.NONTRANSLATED,vcThreadView,this);
    vcLink.setUserObject(msgCount);
    LinkPopupSettings settings=new LinkPopupSettings(800,600,"String_Node_Str");
    vcLink.setPopup(settings);
  }
  allList.add(map);
  LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  String subPath=m.getKey().toString();
  Mark currentMark=marks.get(subPath);
  MarkResourceStat stat=stats.get(subPath);
  MarkingService markingService=(MarkingService)CoreSpringFactory.getBean(MarkingService.class);
  if (!ureq.getUserSession().getRoles().isGuestOnly()) {
    String businessPath=currentMark == null ? getWindowControl().getBusinessControl().getAsString() + "String_Node_Str" + m.getKey()+ "String_Node_Str" : currentMark.getBusinessPath();
    Controller markCtrl=markingService.getMarkController(ureq,getWindowControl(),currentMark,stat,forumOres,subPath,businessPath);
    vcThreadView.put("String_Node_Str" + msgCount,markCtrl.getInitialComponent());
  }
  if (uIsMsgC) {
    OLATResourceable messageOres=OresHelper.createOLATResourceableInstance("String_Node_Str",m.getKey());
    String businessPath=BusinessControlFactory.getInstance().getAsString(getWindowControl().getBusinessControl()) + "String_Node_Str" + m.getKey()+ "String_Node_Str";
    Controller ePFCollCtrl=EPUIFactory.createArtefactCollectWizzardController(ureq,getWindowControl(),messageOres,businessPath);
    if (ePFCollCtrl != null) {
      String ePFAddComponentName="String_Node_Str" + msgCount;
      map.put("String_Node_Str",ePFCollCtrl);
      map.put("String_Node_Str",ePFAddComponentName);
      vcThreadView.put(ePFAddComponentName,ePFCollCtrl.getInitialComponent());
    }
  }
}

Fixed version (ground truth):
private void addMessageToCurrentMessagesAndVC(UserRequest ureq,Message m,VelocityContainer vcContainer,List<Map<String,Object>> allList,int msgCount,Map<String,Mark> marks,Map<String,MarkResourceStat> stats){
  Map<String,Object> map=new HashMap<String,Object>();
  map.put("String_Node_Str",m.getKey());
  if (rms.contains(m.getKey())) {
    map.put("String_Node_Str",Boolean.FALSE);
  }
 else {
    markRead(m,ureq.getIdentity());
    map.put("String_Node_Str",Boolean.TRUE);
  }
  Date creationDate=m.getCreationDate();
  Identity modifier=m.getModifier();
  if (modifier != null) {
    map.put("String_Node_Str",Boolean.TRUE);
    map.put("String_Node_Str",modifier.getUser().getProperty(UserConstants.FIRSTNAME,ureq.getLocale()));
    map.put("String_Node_Str",modifier.getUser().getProperty(UserConstants.LASTNAME,ureq.getLocale()));
  }
 else {
    map.put("String_Node_Str",Boolean.FALSE);
  }
  map.put("String_Node_Str",m.getTitle());
  map.put("String_Node_Str",m.getBody());
  map.put("String_Node_Str",f.formatDateAndTime(creationDate));
  Identity creator=m.getCreator();
  map.put("String_Node_Str",creator.getKey());
  map.put("String_Node_Str",Formatter.truncate(creator.getUser().getProperty(UserConstants.FIRSTNAME,ureq.getLocale()),18));
  map.put("String_Node_Str",Formatter.truncate(creator.getUser().getProperty(UserConstants.LASTNAME,ureq.getLocale()),18));
  map.put("String_Node_Str",f.formatDateAndTime(m.getLastModified()));
  OlatRootFolderImpl msgContainer=fm.getMessageContainer(forum.getKey(),m.getKey());
  map.put("String_Node_Str",msgContainer);
  final List<VFSItem> attachments=new ArrayList<VFSItem>(msgContainer.getItems(new VFSItemExcludePrefixFilter(MessageEditController.ATTACHMENT_EXCLUDE_PREFIXES)));
  map.put("String_Node_Str",attachments);
  if (attachments == null || attachments.size() == 0)   map.put("String_Node_Str",Boolean.FALSE);
 else   map.put("String_Node_Str",Boolean.TRUE);
  int numOfChildren;
  numOfChildren=countNumOfChildren(m,threadMsgs);
  Integer nOfCh=new Integer(numOfChildren);
  map.put("String_Node_Str",nOfCh);
  boolean userIsMsgCreator=ureq.getIdentity().getKey().equals(creator.getKey());
  Boolean uIsMsgC=new Boolean(userIsMsgCreator);
  map.put("String_Node_Str",uIsMsgC);
  boolean isThreadtop=m.getThreadtop() == null;
  map.put("String_Node_Str",Boolean.valueOf(isThreadtop));
  boolean isThreadClosed=Status.getStatus(m.getStatusCode()).isClosed();
  if (!isThreadtop) {
    isThreadClosed=Status.getStatus(m.getThreadtop().getStatusCode()).isClosed();
  }
  map.put("String_Node_Str",isThreadClosed);
  if (!isGuestOnly(ureq)) {
    DisplayPortraitController portrait=new DisplayPortraitController(ureq,getWindowControl(),m.getCreator(),true,true,false,true);
    map.put("String_Node_Str",portrait);
    String portraitComponentVCName=m.getKey().toString();
    map.put("String_Node_Str",portraitComponentVCName);
    vcContainer.put(portraitComponentVCName,portrait.getInitialComponent());
    Link vcLink=LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,UserManager.getInstance().getUserDisplayName(creator),Link.LINK_CUSTOM_CSS + Link.NONTRANSLATED,vcThreadView,this);
    vcLink.setUserObject(msgCount);
    LinkPopupSettings settings=new LinkPopupSettings(800,600,"String_Node_Str");
    vcLink.setPopup(settings);
  }
  allList.add(map);
  Link dlLink=LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  dlLink.setIconLeftCSS("String_Node_Str");
  Link edLink=LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  edLink.setIconLeftCSS("String_Node_Str");
  Link qtLink=LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  qtLink.setIconLeftCSS("String_Node_Str");
  Link rpLink=LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.BUTTON_SMALL,vcThreadView,this);
  rpLink.setIconLeftCSS("String_Node_Str");
  Link splitLink=LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.LINK,vcThreadView,this);
  splitLink.setIconLeftCSS("String_Node_Str");
  Link moveLink=LinkFactory.createCustomLink("String_Node_Str" + msgCount,"String_Node_Str" + msgCount,"String_Node_Str",Link.LINK,vcThreadView,this);
  moveLink.setIconLeftCSS("String_Node_Str");
  String subPath=m.getKey().toString();
  Mark currentMark=marks.get(subPath);
  MarkResourceStat stat=stats.get(subPath);
  MarkingService markingService=(MarkingService)CoreSpringFactory.getBean(MarkingService.class);
  if (!ureq.getUserSession().getRoles().isGuestOnly()) {
    String businessPath=currentMark == null ? getWindowControl().getBusinessControl().getAsString() + "String_Node_Str" + m.getKey()+ "String_Node_Str" : currentMark.getBusinessPath();
    Controller markCtrl=markingService.getMarkController(ureq,getWindowControl(),currentMark,stat,forumOres,subPath,businessPath);
    vcThreadView.put("String_Node_Str" + msgCount,markCtrl.getInitialComponent());
  }
  if (uIsMsgC) {
    OLATResourceable messageOres=OresHelper.createOLATResourceableInstance("String_Node_Str",m.getKey());
    String businessPath=BusinessControlFactory.getInstance().getAsString(getWindowControl().getBusinessControl()) + "String_Node_Str" + m.getKey()+ "String_Node_Str";
    Controller ePFCollCtrl=EPUIFactory.createArtefactCollectWizzardController(ureq,getWindowControl(),messageOres,businessPath);
    if (ePFCollCtrl != null) {
      String ePFAddComponentName="String_Node_Str" + msgCount;
      map.put("String_Node_Str",ePFCollCtrl);
      map.put("String_Node_Str",ePFAddComponentName);
      vcThreadView.put(ePFAddComponentName,ePFCollCtrl.getInitialComponent());
    }
  }
}