Program: 69645
Project: 69645
Buggy source:
private void init(IQSecurityCallback secCallback,UserRequest ureq){
  this.iqsec=secCallback;
  this.translator=Util.createPackageTranslator(IQDisplayController.class,ureq.getLocale());
  this.ready=false;
  retrieveListenerOres=new IQRetrievedEvent(ureq.getIdentity(),callingResId,callingResDetail);
  CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this,ureq.getIdentity(),retrieveListenerOres);
  iqm=CoreSpringFactory.getImpl(IQManager.class);
  myContent=new VelocityContainer("String_Node_Str",VELOCITY_ROOT + "String_Node_Str",translator,this);
  Resolver autcompResolver=null;
  if (resolver == null) {
    RepositoryEntry re=RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftkey,true);
    autcompResolver=new ImsRepositoryResolver(re);
  }
 else {
    autcompResolver=this.resolver;
  }
  if (autcompResolver != null && autcompResolver.hasAutocompleteFiles()) {
    StringBuilder sb=new StringBuilder();
    sb.append("String_Node_Str").append(autcompResolver.getStaticsBaseURI()).append("String_Node_Str").append(ImsRepositoryResolver.QTI_FIB_AUTOCOMPLETE_JS_FILE).append("String_Node_Str");
    sb.append("String_Node_Str").append(autcompResolver.getStaticsBaseURI()).append("String_Node_Str").append(ImsRepositoryResolver.QTI_FIB_AUTOCOMPLETE_CSS_FILE).append("String_Node_Str");
    JSAndCSSComponent autoCompleteJsCss=new JSAndCSSComponent("String_Node_Str",this.getClass(),true,sb.toString());
    myContent.put("String_Node_Str",autoCompleteJsCss);
  }
  closeButton=LinkFactory.createButton("String_Node_Str",myContent,this);
  qtiscoreprogress=new ProgressBar("String_Node_Str",150,0,0,"String_Node_Str");
  myContent.put("String_Node_Str",qtiscoreprogress);
  Boolean displayScoreProgress=(Boolean)modConfig.get(IQEditController.CONFIG_KEY_SCOREPROGRESS);
  if (displayScoreProgress == null)   displayScoreProgress=Boolean.TRUE;
  if (!displayScoreProgress.booleanValue())   qtiscoreprogress.setVisible(false);
  myContent.contextPut("String_Node_Str",displayScoreProgress);
  qtiquestionprogress=new ProgressBar("String_Node_Str",150,0,0,"String_Node_Str");
  myContent.put("String_Node_Str",qtiquestionprogress);
  Boolean displayQuestionProgress=(Boolean)modConfig.get(IQEditController.CONFIG_KEY_QUESTIONPROGRESS);
  if (displayQuestionProgress == null)   displayQuestionProgress=Boolean.FALSE;
  if (!displayQuestionProgress.booleanValue())   qtiquestionprogress.setVisible(false);
  myContent.contextPut("String_Node_Str",displayQuestionProgress);
  Boolean displayMenu=(Boolean)modConfig.get(IQEditController.CONFIG_KEY_DISPLAYMENU);
  if (displayMenu == null)   displayMenu=Boolean.TRUE;
  myContent.contextPut("String_Node_Str",displayMenu);
  Boolean enableCancel=(Boolean)modConfig.get(IQEditController.CONFIG_KEY_ENABLECANCEL);
  if (enableCancel == null) {
    if (modConfig.get(IQEditController.CONFIG_KEY_TYPE).equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS))     enableCancel=Boolean.FALSE;
 else     enableCancel=Boolean.TRUE;
  }
  myContent.contextPut("String_Node_Str",enableCancel);
  Boolean enableSuspend=(Boolean)modConfig.get(IQEditController.CONFIG_KEY_ENABLESUSPEND);
  if (enableSuspend == null)   enableSuspend=Boolean.FALSE;
  myContent.contextPut("String_Node_Str",enableSuspend);
  qtistatus=new IQStatus(translator);
  qtistatus.setPreview(iqsec.isPreview());
  myContent.contextPut("String_Node_Str",qtistatus);
  setInitialComponent(myContent);
  AssessmentInstance ai=null;
  if (repositorySoftkey != null) {
    String resourcePathInfo=callingResId + File.separator + callingResDetail;
    ai=AssessmentFactory.createAssessmentInstance(ureq.getIdentity(),ureq.getHttpReq().getRemoteAddr(),modConfig,iqsec.isPreview(),callingResId,callingResDetail,resourcePathInfo,this);
  }
 else   if (resolver != null) {
    ai=AssessmentFactory.createAssessmentInstance(ureq.getIdentity(),ureq.getHttpReq().getRemoteAddr(),callingResId,callingResDetail,resolver,persister,modConfig,this);
  }
  if (ai == null || ai.getAssessmentContext().getSectionContext(0).getItemContextCount() == 0)   throw new AssertException("String_Node_Str");
  if (!iqsec.isAllowed(ai)) {
    getWindowControl().setError(translator.translate("String_Node_Str"));
    return;
  }
  if (iqsec.attemptsLeft(ai) < 1) {
    getWindowControl().setInfo(translator.translate(ai.isSurvey() ? "String_Node_Str" : "String_Node_Str"));
    return;
  }
  if (ai.isResuming()) {
    getWindowControl().setInfo(translator.translate(ai.isSurvey() ? "String_Node_Str" : "String_Node_Str"));
  }
  ai.setPreview(iqsec.isPreview());
  Object tmp=modConfig.get(IQEditController.CONFIG_KEY_RENDERMENUOPTION);
  Boolean renderSectionsOnly;
  if (tmp == null) {
    modConfig.set(IQEditController.CONFIG_KEY_RENDERMENUOPTION,Boolean.FALSE);
    renderSectionsOnly=Boolean.FALSE;
  }
 else {
    renderSectionsOnly=(Boolean)tmp;
  }
  boolean enabledMenu=((Boolean)modConfig.get(IQEditController.CONFIG_KEY_ENABLEMENU)).booleanValue();
  boolean itemPageSequence=((String)modConfig.get(IQEditController.CONFIG_KEY_SEQUENCE)).equals(AssessmentInstance.QMD_ENTRY_SEQUENCE_ITEM);
  IQMenuDisplayConf mdc=new IQMenuDisplayConf(renderSectionsOnly.booleanValue(),enabledMenu,itemPageSequence);
  tmp=modConfig.get(IQEditController.CONFIG_KEY_MEMO);
  boolean memo=tmp == null ? false : ((Boolean)tmp).booleanValue();
  qticomp=new IQComponent("String_Node_Str",translator,ai,mdc,memo);
  qticomp.addListener(this);
  myContent.put("String_Node_Str",qticomp);
  if (!ai.isResuming()) {
    Navigator navigator=ai.getNavigator();
    navigator.startAssessment();
  }
 else {
    AssessmentContext act=ai.getAssessmentContext();
    if (act.getCurrentSectionContextPos() >= 0) {
      int sectionPos=act.getCurrentSectionContextPos();
      OLATResourceable sres=OresHelper.createOLATResourceableInstance("String_Node_Str",new Long(sectionPos));
      WindowControl bwControl=addToHistory(ureq,sres,null,getWindowControl(),false);
      if (!ai.isSectionPage()) {
        SectionContext sct=act.getCurrentSectionContext();
        int itemPos=sct.getCurrentItemContextPos();
        if (itemPos >= 0) {
          OLATResourceable ires=OresHelper.createOLATResourceableInstance("String_Node_Str",new Long(itemPos));
          addToHistory(ureq,ires,null,bwControl,true);
        }
      }
    }
  }
  qtistatus.update(ai);
  if (!qtistatus.isSurvey()) {
    qtiscoreprogress.setMax(ai.getAssessmentContext().getMaxScore());
    qtiscoreprogress.setActual(ai.getAssessmentContext().getScore());
  }
  qtiquestionprogress.setMax(Integer.parseInt(qtistatus.getMaxQuestions()));
  updateQuestionProgressDisplay(ai);
  ready=true;
}

Fixed version (ground truth):
private void init(IQSecurityCallback secCallback,UserRequest ureq){
  this.iqsec=secCallback;
  this.translator=Util.createPackageTranslator(IQDisplayController.class,ureq.getLocale());
  this.ready=false;
  retrieveListenerOres=new IQRetrievedEvent(ureq.getIdentity(),callingResId,callingResDetail);
  CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this,ureq.getIdentity(),retrieveListenerOres);
  iqm=CoreSpringFactory.getImpl(IQManager.class);
  myContent=new VelocityContainer("String_Node_Str",VELOCITY_ROOT + "String_Node_Str",translator,this);
  Resolver autcompResolver=null;
  if (resolver == null) {
    RepositoryEntry re=RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftkey,true);
    autcompResolver=new ImsRepositoryResolver(re);
  }
 else {
    autcompResolver=this.resolver;
  }
  if (autcompResolver != null && autcompResolver.hasAutocompleteFiles()) {
    StringBuilder sb=new StringBuilder();
    sb.append("String_Node_Str").append(autcompResolver.getStaticsBaseURI()).append("String_Node_Str").append(ImsRepositoryResolver.QTI_FIB_AUTOCOMPLETE_JS_FILE).append("String_Node_Str");
    sb.append("String_Node_Str").append(autcompResolver.getStaticsBaseURI()).append("String_Node_Str").append(ImsRepositoryResolver.QTI_FIB_AUTOCOMPLETE_CSS_FILE).append("String_Node_Str");
    JSAndCSSComponent autoCompleteJsCss=new JSAndCSSComponent("String_Node_Str",this.getClass(),true,sb.toString());
    myContent.put("String_Node_Str",autoCompleteJsCss);
  }
  closeButton=LinkFactory.createButton("String_Node_Str",myContent,this);
  closeButton.setPrimary(true);
  qtiscoreprogress=new ProgressBar("String_Node_Str",150,0,0,"String_Node_Str");
  myContent.put("String_Node_Str",qtiscoreprogress);
  Boolean displayScoreProgress=(Boolean)modConfig.get(IQEditController.CONFIG_KEY_SCOREPROGRESS);
  if (displayScoreProgress == null)   displayScoreProgress=Boolean.TRUE;
  if (!displayScoreProgress.booleanValue())   qtiscoreprogress.setVisible(false);
  myContent.contextPut("String_Node_Str",displayScoreProgress);
  qtiquestionprogress=new ProgressBar("String_Node_Str",150,0,0,"String_Node_Str");
  myContent.put("String_Node_Str",qtiquestionprogress);
  Boolean displayQuestionProgress=(Boolean)modConfig.get(IQEditController.CONFIG_KEY_QUESTIONPROGRESS);
  if (displayQuestionProgress == null)   displayQuestionProgress=Boolean.FALSE;
  if (!displayQuestionProgress.booleanValue())   qtiquestionprogress.setVisible(false);
  myContent.contextPut("String_Node_Str",displayQuestionProgress);
  Boolean displayMenu=(Boolean)modConfig.get(IQEditController.CONFIG_KEY_DISPLAYMENU);
  if (displayMenu == null)   displayMenu=Boolean.TRUE;
  myContent.contextPut("String_Node_Str",displayMenu);
  Boolean enableCancel=(Boolean)modConfig.get(IQEditController.CONFIG_KEY_ENABLECANCEL);
  if (enableCancel == null) {
    if (modConfig.get(IQEditController.CONFIG_KEY_TYPE).equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS))     enableCancel=Boolean.FALSE;
 else     enableCancel=Boolean.TRUE;
  }
  myContent.contextPut("String_Node_Str",enableCancel);
  Boolean enableSuspend=(Boolean)modConfig.get(IQEditController.CONFIG_KEY_ENABLESUSPEND);
  if (enableSuspend == null)   enableSuspend=Boolean.FALSE;
  myContent.contextPut("String_Node_Str",enableSuspend);
  qtistatus=new IQStatus(translator);
  qtistatus.setPreview(iqsec.isPreview());
  myContent.contextPut("String_Node_Str",qtistatus);
  setInitialComponent(myContent);
  AssessmentInstance ai=null;
  if (repositorySoftkey != null) {
    String resourcePathInfo=callingResId + File.separator + callingResDetail;
    ai=AssessmentFactory.createAssessmentInstance(ureq.getIdentity(),ureq.getHttpReq().getRemoteAddr(),modConfig,iqsec.isPreview(),callingResId,callingResDetail,resourcePathInfo,this);
  }
 else   if (resolver != null) {
    ai=AssessmentFactory.createAssessmentInstance(ureq.getIdentity(),ureq.getHttpReq().getRemoteAddr(),callingResId,callingResDetail,resolver,persister,modConfig,this);
  }
  if (ai == null || ai.getAssessmentContext().getSectionContext(0).getItemContextCount() == 0)   throw new AssertException("String_Node_Str");
  if (!iqsec.isAllowed(ai)) {
    getWindowControl().setError(translator.translate("String_Node_Str"));
    return;
  }
  if (iqsec.attemptsLeft(ai) < 1) {
    getWindowControl().setInfo(translator.translate(ai.isSurvey() ? "String_Node_Str" : "String_Node_Str"));
    return;
  }
  if (ai.isResuming()) {
    getWindowControl().setInfo(translator.translate(ai.isSurvey() ? "String_Node_Str" : "String_Node_Str"));
  }
  ai.setPreview(iqsec.isPreview());
  Object tmp=modConfig.get(IQEditController.CONFIG_KEY_RENDERMENUOPTION);
  Boolean renderSectionsOnly;
  if (tmp == null) {
    modConfig.set(IQEditController.CONFIG_KEY_RENDERMENUOPTION,Boolean.FALSE);
    renderSectionsOnly=Boolean.FALSE;
  }
 else {
    renderSectionsOnly=(Boolean)tmp;
  }
  boolean enabledMenu=((Boolean)modConfig.get(IQEditController.CONFIG_KEY_ENABLEMENU)).booleanValue();
  boolean itemPageSequence=((String)modConfig.get(IQEditController.CONFIG_KEY_SEQUENCE)).equals(AssessmentInstance.QMD_ENTRY_SEQUENCE_ITEM);
  IQMenuDisplayConf mdc=new IQMenuDisplayConf(renderSectionsOnly.booleanValue(),enabledMenu,itemPageSequence);
  tmp=modConfig.get(IQEditController.CONFIG_KEY_MEMO);
  boolean memo=tmp == null ? false : ((Boolean)tmp).booleanValue();
  qticomp=new IQComponent("String_Node_Str",translator,ai,mdc,memo);
  qticomp.addListener(this);
  myContent.put("String_Node_Str",qticomp);
  if (!ai.isResuming()) {
    Navigator navigator=ai.getNavigator();
    navigator.startAssessment();
  }
 else {
    AssessmentContext act=ai.getAssessmentContext();
    if (act.getCurrentSectionContextPos() >= 0) {
      int sectionPos=act.getCurrentSectionContextPos();
      OLATResourceable sres=OresHelper.createOLATResourceableInstance("String_Node_Str",new Long(sectionPos));
      WindowControl bwControl=addToHistory(ureq,sres,null,getWindowControl(),false);
      if (!ai.isSectionPage()) {
        SectionContext sct=act.getCurrentSectionContext();
        int itemPos=sct.getCurrentItemContextPos();
        if (itemPos >= 0) {
          OLATResourceable ires=OresHelper.createOLATResourceableInstance("String_Node_Str",new Long(itemPos));
          addToHistory(ureq,ires,null,bwControl,true);
        }
      }
    }
  }
  qtistatus.update(ai);
  if (!qtistatus.isSurvey()) {
    qtiscoreprogress.setMax(ai.getAssessmentContext().getMaxScore());
    qtiscoreprogress.setActual(ai.getAssessmentContext().getScore());
  }
  qtiquestionprogress.setMax(Integer.parseInt(qtistatus.getMaxQuestions()));
  updateQuestionProgressDisplay(ai);
  ready=true;
}