Program: 69485
Project: 69485
Buggy source:
/** 
 * Do not use this constructor! Use the BGControllerFactory instead!
 * @param ureq
 * @param control
 * @param currBusinessGroup
 * @param flags
 * @param initialViewIdentifier supported are null, "toolforum", "toolfolder"
 */
public BusinessGroupMainRunController(UserRequest ureq,WindowControl control,BusinessGroup bGroup){
  super(ureq,control);
  assessmentEventOres=OresHelper.createOLATResourceableType(AssessmentEvent.class);
  nodeIdPrefix="String_Node_Str".concat(Long.toString(CodeHelper.getRAMUniqueID()));
  toolbarPanel=new TooledStackedPanel("String_Node_Str",getTranslator(),this);
  toolbarPanel.setInvisibleCrumb(0);
  toolbarPanel.setToolbarEnabled(false);
  toolbarPanel.setShowCloseLink(true,true);
  UserSession session=ureq.getUserSession();
  if (session != null && session.getHistoryStack() != null && session.getHistoryStack().size() >= 2) {
    List<HistoryPoint> stack=session.getHistoryStack();
    for (int i=stack.size() - 2; i-- > 0; ) {
      HistoryPoint point=stack.get(stack.size() - 2);
      if (point.getEntries().size() > 0) {
        OLATResourceable ores=point.getEntries().get(0).getOLATResourceable();
        if (!OresHelper.equals(bGroup,ores) && !OresHelper.equals(bGroup.getResource(),ores)) {
          launchedFromPoint=point;
          break;
        }
      }
    }
  }
  businessGroup=businessGroupService.setLastUsageFor(getIdentity(),bGroup);
  if (businessGroup == null) {
    VelocityContainer vc=createVelocityContainer("String_Node_Str");
    vc.contextPut("String_Node_Str",bGroup.getName());
    columnLayoutCtr=new LayoutMain3ColsController(ureq,getWindowControl(),null,vc,"String_Node_Str");
    listenTo(columnLayoutCtr);
    putInitialPanel(columnLayoutCtr.getInitialComponent());
    chatAvailable=false;
    return;
  }
  List<BusinessGroupMembership> memberships=businessGroupService.getBusinessGroupMembership(Collections.singletonList(bGroup.getKey()),getIdentity());
  if (isOnWaitinglist(memberships)) {
    putInitialPanel(getOnWaitingListMessage(ureq,bGroup));
    chatAvailable=false;
    return;
  }
 else   if (ureq.getUserSession().getRoles().isGuestOnly()) {
    putInitialPanel(getNoAccessMessage(ureq,bGroup));
    chatAvailable=false;
    return;
  }
  addLoggingResourceable(LoggingResourceable.wrap(businessGroup));
  ThreadLocalUserActivityLogger.log(GroupLoggingAction.GROUP_OPEN,getClass());
  UserSession usess=ureq.getUserSession();
  Object wcard=usess.removeEntry("String_Node_Str" + businessGroup.getKey());
  isGroupsAdmin=usess.getRoles().isOLATAdmin() || usess.getRoles().isGroupManager();
  chatAvailable=isChatAvailable();
  isAdmin=(wcard != null && Boolean.TRUE.equals(wcard)) || isGroupsAdmin || businessGroupService.isIdentityInBusinessGroup(getIdentity(),businessGroup.getKey(),true,false,null);
  setTranslator(Util.createPackageTranslator(BGControllerFactory.class,getLocale(),getTranslator()));
  resourceTrans=Util.createPackageTranslator(RepositoryService.class,getLocale(),getTranslator());
  main=createVelocityContainer("String_Node_Str");
  exposeGroupDetailsToVC(businessGroup);
  mainPanel=new Panel("String_Node_Str");
  mainPanel.setContent(main);
  bgTree=new MenuTree("String_Node_Str");
  TreeModel trMdl=buildTreeModel();
  bgTree.setTreeModel(trMdl);
  bgTree.addListener(this);
  columnLayoutCtr=new LayoutMain3ColsController(ureq,getWindowControl(),bgTree,mainPanel,"String_Node_Str");
  toolbarPanel.pushController(bGroup.getName(),columnLayoutCtr);
  listenTo(columnLayoutCtr);
  putInitialPanel(toolbarPanel);
  singleUserEventBus=ureq.getUserSession().getSingleUserEventCenter();
  singleUserEventBus.registerFor(this,ureq.getIdentity(),assessmentEventOres);
  Panel empty=new Panel("String_Node_Str");
  Controller disposedBusinessGroup=new DisposedBusinessGroup(ureq,getWindowControl());
  LayoutMain3ColsController disposedController=new LayoutMain3ColsController(ureq,getWindowControl(),empty,disposedBusinessGroup.getInitialComponent(),"String_Node_Str");
  disposedController.addDisposableChildController(disposedBusinessGroup);
  setDisposedMsgController(disposedController);
  CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this,getIdentity(),businessGroup);
  if (AssessmentEvent.isAssessmentStarted(ureq.getUserSession())) {
    groupRunDisabled=true;
    showError("String_Node_Str");
  }
  if (wcard == null) {
    AccessResult acResult=acService.isAccessible(businessGroup,getIdentity(),false);
    if (acResult.isAccessible()) {
      needActivation=false;
    }
 else     if (businessGroup != null && acResult.getAvailableMethods().size() > 0) {
      accessController=new AccessListController(ureq,getWindowControl(),acResult.getAvailableMethods());
      listenTo(accessController);
      mainPanel.setContent(accessController.getInitialComponent());
      bgTree.setTreeModel(new GenericTreeModel());
      needActivation=true;
    }
 else {
      mainPanel.setContent(new Panel("String_Node_Str"));
      bgTree.setTreeModel(new GenericTreeModel());
      needActivation=true;
    }
    wildcard=false;
  }
 else {
    needActivation=false;
    wildcard=true;
  }
}

Fixed version (ground truth):
/** 
 * Do not use this constructor! Use the BGControllerFactory instead!
 * @param ureq
 * @param control
 * @param currBusinessGroup
 * @param flags
 * @param initialViewIdentifier supported are null, "toolforum", "toolfolder"
 */
public BusinessGroupMainRunController(UserRequest ureq,WindowControl control,BusinessGroup bGroup){
  super(ureq,control);
  assessmentEventOres=OresHelper.createOLATResourceableType(AssessmentEvent.class);
  nodeIdPrefix="String_Node_Str".concat(Long.toString(CodeHelper.getRAMUniqueID()));
  toolbarPanel=new TooledStackedPanel("String_Node_Str",getTranslator(),this);
  toolbarPanel.setInvisibleCrumb(0);
  toolbarPanel.setToolbarEnabled(false);
  toolbarPanel.setShowCloseLink(true,true);
  UserSession session=ureq.getUserSession();
  if (session != null && session.getHistoryStack() != null && session.getHistoryStack().size() >= 2) {
    List<HistoryPoint> stack=session.getHistoryStack();
    for (int i=stack.size() - 2; i-- > 0; ) {
      HistoryPoint point=stack.get(stack.size() - 2);
      if (point.getEntries().size() > 0) {
        OLATResourceable ores=point.getEntries().get(0).getOLATResourceable();
        if (!OresHelper.equals(bGroup,ores) && !OresHelper.equals(bGroup.getResource(),ores)) {
          launchedFromPoint=point;
          break;
        }
      }
    }
  }
  businessGroup=businessGroupService.setLastUsageFor(getIdentity(),bGroup);
  if (businessGroup == null) {
    VelocityContainer vc=createVelocityContainer("String_Node_Str");
    vc.contextPut("String_Node_Str",bGroup.getName());
    columnLayoutCtr=new LayoutMain3ColsController(ureq,getWindowControl(),null,vc,"String_Node_Str");
    listenTo(columnLayoutCtr);
    putInitialPanel(columnLayoutCtr.getInitialComponent());
    chatAvailable=false;
    return;
  }
  List<BusinessGroupMembership> memberships=businessGroupService.getBusinessGroupMembership(Collections.singletonList(bGroup.getKey()),getIdentity());
  if (isOnWaitinglist(memberships)) {
    putInitialPanel(getOnWaitingListMessage(ureq,bGroup));
    chatAvailable=false;
    return;
  }
 else   if (ureq.getUserSession().getRoles().isGuestOnly()) {
    putInitialPanel(getNoAccessMessage(ureq,bGroup));
    chatAvailable=false;
    return;
  }
  addLoggingResourceable(LoggingResourceable.wrap(businessGroup));
  ThreadLocalUserActivityLogger.log(GroupLoggingAction.GROUP_OPEN,getClass());
  UserSession usess=ureq.getUserSession();
  Object wcard=usess.removeEntry("String_Node_Str" + businessGroup.getKey());
  isGroupsAdmin=usess.getRoles().isOLATAdmin() || usess.getRoles().isGroupManager();
  chatAvailable=isChatAvailable();
  isAdmin=(wcard != null && Boolean.TRUE.equals(wcard)) || isGroupsAdmin || businessGroupService.isIdentityInBusinessGroup(getIdentity(),businessGroup.getKey(),true,false,null);
  setTranslator(Util.createPackageTranslator(BGControllerFactory.class,getLocale(),getTranslator()));
  resourceTrans=Util.createPackageTranslator(RepositoryService.class,getLocale(),getTranslator());
  main=createVelocityContainer("String_Node_Str");
  exposeGroupDetailsToVC(businessGroup);
  mainPanel=new Panel("String_Node_Str");
  mainPanel.setContent(main);
  bgTree=new MenuTree("String_Node_Str","String_Node_Str");
  TreeModel trMdl=buildTreeModel();
  bgTree.setTreeModel(trMdl);
  bgTree.addListener(this);
  columnLayoutCtr=new LayoutMain3ColsController(ureq,getWindowControl(),bgTree,mainPanel,"String_Node_Str");
  toolbarPanel.pushController(bGroup.getName(),columnLayoutCtr);
  listenTo(columnLayoutCtr);
  putInitialPanel(toolbarPanel);
  singleUserEventBus=ureq.getUserSession().getSingleUserEventCenter();
  singleUserEventBus.registerFor(this,ureq.getIdentity(),assessmentEventOres);
  Panel empty=new Panel("String_Node_Str");
  Controller disposedBusinessGroup=new DisposedBusinessGroup(ureq,getWindowControl());
  LayoutMain3ColsController disposedController=new LayoutMain3ColsController(ureq,getWindowControl(),empty,disposedBusinessGroup.getInitialComponent(),"String_Node_Str");
  disposedController.addDisposableChildController(disposedBusinessGroup);
  setDisposedMsgController(disposedController);
  CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this,getIdentity(),businessGroup);
  if (AssessmentEvent.isAssessmentStarted(ureq.getUserSession())) {
    groupRunDisabled=true;
    showError("String_Node_Str");
  }
  if (wcard == null) {
    AccessResult acResult=acService.isAccessible(businessGroup,getIdentity(),false);
    if (acResult.isAccessible()) {
      needActivation=false;
    }
 else     if (businessGroup != null && acResult.getAvailableMethods().size() > 0) {
      accessController=new AccessListController(ureq,getWindowControl(),acResult.getAvailableMethods());
      listenTo(accessController);
      mainPanel.setContent(accessController.getInitialComponent());
      bgTree.setTreeModel(new GenericTreeModel());
      needActivation=true;
    }
 else {
      mainPanel.setContent(new Panel("String_Node_Str"));
      bgTree.setTreeModel(new GenericTreeModel());
      needActivation=true;
    }
    wildcard=false;
  }
 else {
    needActivation=false;
    wildcard=true;
  }
}