Program: 70062
Project: 70062
Buggy source:
/** 
 * TODO: rename to getForumController and save instance?
 * @param ureq
 * @param wControl
 * @param isAdmin
 * @param subsContext the subscriptioncontext if subscriptions to this forumshould be possible
 * @return a forum controller
 */
public Controller createForumController(UserRequest ureq,WindowControl wControl,boolean isAdmin,boolean isGuestOnly,final SubscriptionContext subsContext){
  Codepoint.codepoint(CollaborationTools.class,"String_Node_Str");
  final boolean isAdm=isAdmin;
  final boolean isGuest=isGuestOnly;
  final ForumManager fom=ForumManager.getInstance();
  final NarrowedPropertyManager npm=NarrowedPropertyManager.getInstance(ores);
  Codepoint.codepoint(CollaborationTools.class,"String_Node_Str");
  Forum forum=coordinatorManager.getCoordinator().getSyncer().doInSync(ores,new SyncerCallback<Forum>(){
    public Forum execute(){
      Codepoint.codepoint(CollaborationTools.class,"String_Node_Str");
      Forum aforum;
      Long forumKey;
      Property forumKeyProperty=npm.findProperty(null,null,PROP_CAT_BG_COLLABTOOLS,KEY_FORUM);
      if (forumKeyProperty == null) {
        aforum=fom.addAForum();
        forumKey=aforum.getKey();
        if (log.isDebug()) {
          log.debug("String_Node_Str" + forumKey.longValue() + "String_Node_Str"+ ores.getResourceableTypeName()+ "String_Node_Str"+ ores.getResourceableId());
        }
        forumKeyProperty=npm.createPropertyInstance(null,null,PROP_CAT_BG_COLLABTOOLS,KEY_FORUM,null,forumKey,null,null);
        npm.saveProperty(forumKeyProperty);
      }
 else {
        forumKey=forumKeyProperty.getLongValue();
        aforum=fom.loadForum(forumKey);
        if (aforum == null) {
          throw new AssertException("String_Node_Str" + forumKey.longValue() + "String_Node_Str"+ ores.getResourceableTypeName()+ "String_Node_Str"+ ores.getResourceableId());
        }
        if (log.isDebug()) {
          log.debug("String_Node_Str" + forumKey.longValue() + "String_Node_Str"+ ores.getResourceableTypeName()+ "String_Node_Str"+ ores.getResourceableId());
        }
      }
      Codepoint.codepoint(CollaborationTools.class,"String_Node_Str");
      return aforum;
    }
  }
);
  Translator trans=Util.createPackageTranslator(this.getClass(),ureq.getLocale());
  TitleInfo titleInfo=new TitleInfo(null,trans.translate("String_Node_Str"));
  titleInfo.setSeparatorEnabled(true);
  Controller forumController=ForumUIFactory.getTitledForumController(ureq,wControl,forum,new ForumCallback(){
    public boolean mayOpenNewThread(){
      return true;
    }
    public boolean mayReplyMessage(){
      return true;
    }
    public boolean mayEditMessageAsModerator(){
      return isAdm;
    }
    public boolean mayDeleteMessageAsModerator(){
      return isAdm;
    }
    public boolean mayArchiveForum(){
      return !isGuest;
    }
    public boolean mayFilterForUser(){
      return isAdm;
    }
    public SubscriptionContext getSubscriptionContext(){
      return subsContext;
    }
  }
,titleInfo);
  return forumController;
}

Fixed version (ground truth):
/** 
 * TODO: rename to getForumController and save instance?
 * @param ureq
 * @param wControl
 * @param isAdmin
 * @param subsContext the subscriptioncontext if subscriptions to this forumshould be possible
 * @return a forum controller
 */
public Controller createForumController(UserRequest ureq,WindowControl wControl,boolean isAdmin,boolean isGuestOnly,final SubscriptionContext subsContext){
  Codepoint.codepoint(CollaborationTools.class,"String_Node_Str");
  final boolean isAdm=isAdmin;
  final boolean isGuest=isGuestOnly;
  Forum forum=getForum();
  Translator trans=Util.createPackageTranslator(this.getClass(),ureq.getLocale());
  TitleInfo titleInfo=new TitleInfo(null,trans.translate("String_Node_Str"));
  titleInfo.setSeparatorEnabled(true);
  Controller forumController=ForumUIFactory.getTitledForumController(ureq,wControl,forum,new ForumCallback(){
    public boolean mayOpenNewThread(){
      return true;
    }
    public boolean mayReplyMessage(){
      return true;
    }
    public boolean mayEditMessageAsModerator(){
      return isAdm;
    }
    public boolean mayDeleteMessageAsModerator(){
      return isAdm;
    }
    public boolean mayArchiveForum(){
      return !isGuest;
    }
    public boolean mayFilterForUser(){
      return isAdm;
    }
    public SubscriptionContext getSubscriptionContext(){
      return subsContext;
    }
  }
,titleInfo);
  return forumController;
}