Program: 69927
Project: 69927
Buggy source:
/** 
 * @param browser
 * @param access
 * @param catalog
 * @return true on successPublishes the entire course.
 */
public boolean publishEntireCourse(Selenium browser,AccessSettings access,String catalog){
  StringBuffer selectorBuffer=new StringBuffer();
  selectorBuffer.append("String_Node_Str").append(getCourseEditorPublishCss()).append("String_Node_Str");
  functionalUtil.waitForPageToLoadElement(browser,selectorBuffer.toString());
  browser.click(selectorBuffer.toString());
  selectorBuffer=new StringBuffer();
  selectorBuffer.append("String_Node_Str").append(getCourseEditorPublishWizardSelectAllCss()).append("String_Node_Str");
  functionalUtil.waitForPageToLoadElement(browser,selectorBuffer.toString());
  browser.click(selectorBuffer.toString());
  functionalUtil.clickWizardNext(browser);
  functionalUtil.waitForPageToLoadElement(browser,"String_Node_Str" + getCourseEditorPublishWizardAccessId());
  if (access != null) {
    functionalUtil.selectOption(browser,getCourseEditorPublishWizardAccessId(),access.getAccessValue());
  }
  functionalUtil.clickWizardNext(browser);
  functionalUtil.waitForPageToLoadElement(browser,"String_Node_Str" + getCourseEditorPublishWizardCatalogId());
  if (catalog != null) {
    functionalUtil.selectOption(browser,getCourseEditorPublishWizardCatalogId(),ADD_TO_CATALOG_YES_VALUE);
    selectorBuffer=new StringBuffer();
    selectorBuffer.append("String_Node_Str").append(getAddToCatalogCss()).append("String_Node_Str");
    browser.click(selectorBuffer.toString());
    String[] catalogSelectors=createCatalogSelectors(catalog);
    for (    String catalogSelector : catalogSelectors) {
      functionalUtil.waitForPageToLoadElement(browser,catalogSelector);
      browser.click(catalogSelector);
    }
    selectorBuffer=new StringBuffer();
    selectorBuffer.append("String_Node_Str").append(getCatalogCss()).append("String_Node_Str").append(functionalUtil.getButtonDirtyCss()).append("String_Node_Str");
    functionalUtil.waitForPageToLoadElement(browser,selectorBuffer.toString());
    browser.click(selectorBuffer.toString());
    functionalUtil.waitForPageToUnloadElement(browser,selectorBuffer.toString());
  }
 else {
    functionalUtil.selectOption(browser,getCourseEditorPublishWizardCatalogId(),ADD_TO_CATALOG_NO_VALUE);
  }
  functionalUtil.clickWizardFinish(browser);
  functionalUtil.waitForPageToUnloadElement(browser,"String_Node_Str" + getCourseEditorPublishWizardCatalogId());
  return (true);
}

Fixed version (ground truth):
/** 
 * @param browser
 * @param access
 * @param catalog
 * @return true on successPublishes the entire course.
 */
public boolean publishEntireCourse(Selenium browser,AccessSettings access,String catalog){
  StringBuffer selectorBuffer=new StringBuffer();
  selectorBuffer.append("String_Node_Str").append(getCourseEditorPublishCss()).append("String_Node_Str");
  functionalUtil.waitForPageToLoadElement(browser,selectorBuffer.toString());
  browser.click(selectorBuffer.toString());
  selectorBuffer=new StringBuffer();
  selectorBuffer.append("String_Node_Str").append(getCourseEditorPublishWizardSelectAllCss()).append("String_Node_Str");
  functionalUtil.waitForPageToLoadElement(browser,selectorBuffer.toString());
  browser.click(selectorBuffer.toString());
  functionalUtil.waitForPageToLoad(browser);
  functionalUtil.clickWizardNext(browser);
  functionalUtil.waitForPageToLoadElement(browser,"String_Node_Str" + getCourseEditorPublishWizardAccessId());
  if (access != null) {
    functionalUtil.selectOption(browser,getCourseEditorPublishWizardAccessId(),access.getAccessValue());
  }
  functionalUtil.clickWizardNext(browser);
  functionalUtil.waitForPageToLoadElement(browser,"String_Node_Str" + getCourseEditorPublishWizardCatalogId());
  if (catalog != null) {
    functionalUtil.selectOption(browser,getCourseEditorPublishWizardCatalogId(),ADD_TO_CATALOG_YES_VALUE);
    selectorBuffer=new StringBuffer();
    selectorBuffer.append("String_Node_Str").append(getAddToCatalogCss()).append("String_Node_Str");
    browser.click(selectorBuffer.toString());
    String[] catalogSelectors=createCatalogSelectors(catalog);
    for (    String catalogSelector : catalogSelectors) {
      functionalUtil.waitForPageToLoadElement(browser,catalogSelector);
      if (browser.isElementPresent(catalogSelector + "String_Node_Str")) {
        browser.doubleClick(catalogSelector);
      }
 else {
        browser.click(catalogSelector);
      }
    }
    selectorBuffer=new StringBuffer();
    selectorBuffer.append("String_Node_Str").append(getCatalogCss()).append("String_Node_Str").append(functionalUtil.getButtonDirtyCss()).append("String_Node_Str");
    functionalUtil.waitForPageToLoadElement(browser,selectorBuffer.toString());
    browser.click(selectorBuffer.toString());
    functionalUtil.waitForPageToUnloadElement(browser,selectorBuffer.toString());
  }
 else {
    functionalUtil.selectOption(browser,getCourseEditorPublishWizardCatalogId(),ADD_TO_CATALOG_NO_VALUE);
  }
  functionalUtil.clickWizardFinish(browser);
  functionalUtil.waitForPageToUnloadElement(browser,"String_Node_Str" + getCourseEditorPublishWizardCatalogId());
  return (true);
}