nus-yam/ex-repair huggingface dataset:
Program: 101118
Project: 101118
Buggy source:
public UIUserInGroup() throws Exception {
  UIGrid uiGrid=addChild(UIGridUser.class,"String_Node_Str",null);
  uiGrid.configure("String_Node_Str",USER_BEAN_FIELD,USER_ACTION);
  uiGrid.getUIPageIterator().setId("String_Node_Str");
  addChild(UIGroupMembershipForm.class,null,null);
  UIPopupWindow searchUserPopup=addChild(UIPopupWindow.class,null,"String_Node_Str");
  searchUserPopup.setWindowSize(400,0);
}

Fixed version (ground truth):
public UIUserInGroup() throws Exception {
  UIGrid uiGrid=addChild(UIGridUser.class,"String_Node_Str",null);
  uiGrid.configure("String_Node_Str",USER_BEAN_FIELD,USER_ACTION);
  uiGrid.getUIPageIterator().setId("String_Node_Str");
  addChild(UIGroupMembershipForm.class,null,null);
  UIPopupWindow editMemberPopup=addChild(UIPopupWindow.class,null,"String_Node_Str");
  editMemberPopup.setWindowSize(400,0);
}
Program: 101119
Project: 101119
Buggy source:
public UIGadgetEditMode() throws Exception {
  PortletRequestContext pcontext=(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
  PortletPreferences pref=pcontext.getRequest().getPreferences();
  List<SelectItemOption<String>> options=new ArrayList<SelectItemOption<String>>();
  options.add(new SelectItemOption<String>(REMOTE_TYPE,REMOTE_TYPE));
  options.add(new SelectItemOption<String>(LOCAL_TYPE,LOCAL_TYPE));
  UIFormSelectBox typeSelector=new UIFormSelectBox(TYPE_SELECTOR,null,options);
  typeSelector.setOnChange("String_Node_Str");
  addUIFormInput(typeSelector);
  addUIFormInput(new UIFormStringInput(FIELD_URL,FIELD_URL,pref.getValue("String_Node_Str","String_Node_Str")));
  UIFormSelectBox gadgetSelector=new UIFormSelectBox(GADGET_SELECTOR,null,new ArrayList<SelectItemOption<String>>());
  gadgetSelector.setRendered(false);
  addUIFormInput(gadgetSelector);
  setActions(new String[]{"String_Node_Str"});
}

Fixed version (ground truth):
public UIGadgetEditMode() throws Exception {
  PortletRequestContext pcontext=(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
  PortletPreferences pref=pcontext.getRequest().getPreferences();
  List<SelectItemOption<String>> options=new ArrayList<SelectItemOption<String>>();
  options.add(new SelectItemOption<String>(REMOTE_TYPE,REMOTE_TYPE));
  options.add(new SelectItemOption<String>(LOCAL_TYPE,LOCAL_TYPE));
  UIFormSelectBox typeSelector=new UIFormSelectBox(TYPE_SELECTOR,null,options);
  typeSelector.setOnChange("String_Node_Str");
  addUIFormInput(typeSelector);
  addUIFormInput(new UIFormStringInput(FIELD_URL,FIELD_URL,pref.getValue("String_Node_Str","String_Node_Str")).addValidator(MandatoryValidator.class).addValidator(URLValidator.class));
  UIFormSelectBox gadgetSelector=new UIFormSelectBox(GADGET_SELECTOR,null,new ArrayList<SelectItemOption<String>>());
  gadgetSelector.setRendered(false);
  gadgetSelector.addValidator(MandatoryValidator.class);
  addUIFormInput(gadgetSelector);
  setActions(new String[]{"String_Node_Str"});
}
Program: 101120
Project: 101120
Buggy source:
public void processRender(WebuiRequestContext context) throws Exception {
  initData();
  PortalLayoutService service=getApplicationComponent(PortalLayoutService.class);
  DashboardParent parent=(DashboardParent)((UIComponent)getParent()).getParent();
  Container container=service.getContainer(ROOT_CONTAINER + "String_Node_Str" + windowId,parent.getDashboardOwner());
  UIContainer uiRoot=getChild(UIContainer.class);
  toUIContainer(uiRoot,container);
  JavascriptManager jsmanager=context.getJavascriptManager();
  jsmanager.addCustomizedOnLoadScript("String_Node_Str" + windowId + "String_Node_Str");
  super.processRender(context);
}

Fixed version (ground truth):
public void processRender(WebuiRequestContext context) throws Exception {
  initData();
  PortalLayoutService service=getApplicationComponent(PortalLayoutService.class);
  DashboardParent parent=(DashboardParent)((UIComponent)getParent()).getParent();
  Container container=service.getContainer(ROOT_CONTAINER + "String_Node_Str" + windowId,parent.getDashboardOwner());
  UIContainer uiRoot=getChild(UIContainer.class);
  toUIContainer(uiRoot,container);
  JavascriptManager jsmanager=context.getJavascriptManager();
  jsmanager.addCustomizedOnLoadScript("String_Node_Str" + windowId + "String_Node_Str"+ parent.canEdit()+ "String_Node_Str");
  super.processRender(context);
}
Program: 101121
Project: 101121
Buggy source:
public boolean canEdit(){
  if ("String_Node_Str".equals(owner)) {
    return true;
  }
  PortletRequestContext context=(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
  context.getRemoteUser();
  if (isPrivate) {
    if (context.getRemoteUser().equals(owner))     return true;
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean canEdit(){
  PortletRequestContext context=(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
  String accessUser=context.getRemoteUser();
  if (accessUser == null || accessUser.equals("String_Node_Str"))   return false;
  if ("String_Node_Str".equals(owner)) {
    return true;
  }
  if (isPrivate) {
    if (accessUser.equals(owner))     return true;
  }
  return false;
}
Program: 101122
Project: 101122
Buggy source:
public void renderChildren() throws Exception {
  if (maximizedUIComponent != null) {
    maximizedUIComponent.processRender((WebuiRequestContext)WebuiRequestContext.getCurrentInstance());
    return;
  }
  if (uicomponent_ == null) {
    setPageBody(Util.getUIPortal().getSelectedNode(),Util.getUIPortal());
  }
  if (uicomponent_ != null) {
    uicomponent_.processRender((WebuiRequestContext)WebuiRequestContext.getCurrentInstance());
  }
}

Fixed version (ground truth):
public void renderChildren() throws Exception {
  uicomponent_.processRender((WebuiRequestContext)WebuiRequestContext.getCurrentInstance());
}
Program: 101123
Project: 101123
Buggy source:
public final List<ApplicationCategory> getCategories() throws Exception {
  ApplicationRegistryService service=getApplicationComponent(ApplicationRegistryService.class);
  String remoteUser=((WebuiRequestContext)WebuiRequestContext.getCurrentInstance()).getRemoteUser();
  List<ApplicationCategory> listCategories=service.getApplicationCategories(remoteUser,org.exoplatform.web.application.Application.EXO_GAGGET_TYPE);
  gadgets=new Hashtable<ApplicationCategory,List<Application>>();
  for (int i=0; i < listCategories.size(); i++) {
    ApplicationCategory cate=listCategories.get(i);
    List<Application> listGadgets=service.getApplications(cate,org.exoplatform.web.application.Application.EXO_GAGGET_TYPE);
    if (listGadgets == null || listGadgets.size() == 0) {
      listCategories.remove(i);
      i--;
    }
 else {
      gadgets.put(cate,listGadgets);
    }
  }
  categories=listCategories;
  return categories;
}

Fixed version (ground truth):
public final List<ApplicationCategory> getCategories() throws Exception {
  ApplicationRegistryService service=getApplicationComponent(ApplicationRegistryService.class);
  String remoteUser=((WebuiRequestContext)WebuiRequestContext.getCurrentInstance()).getRemoteUser();
  List<ApplicationCategory> listCategories=service.getApplicationCategories(remoteUser,org.exoplatform.web.application.Application.EXO_GAGGET_TYPE);
  gadgets=new Hashtable<ApplicationCategory,List<Application>>();
  for (int i=0; i < listCategories.size(); i++) {
    ApplicationCategory cate=listCategories.get(i);
    List<Application> listGadgets=service.getApplications(cate,org.exoplatform.web.application.Application.EXO_GAGGET_TYPE);
    if (listGadgets == null || listGadgets.size() == 0) {
      listCategories.remove(i);
      i--;
    }
 else {
      gadgets.put(cate,listGadgets);
    }
  }
  Collections.sort(listCategories,new Comparator<ApplicationCategory>(){
    public int compare(    ApplicationCategory cate1,    ApplicationCategory cate2){
      return cate1.getDisplayName().compareToIgnoreCase(cate2.getDisplayName());
    }
  }
);
  categories=listCategories;
  return categories;
}
Program: 101124
Project: 101124
Buggy source:
public List<Application> getGadgetsOfCategory(final ApplicationCategory appCategory) throws Exception {
  List<Application> listGadgets=gadgets.get(appCategory);
  if (listGadgets == null || listGadgets.size() == 0) {
    return null;
  }
  return listGadgets;
}

Fixed version (ground truth):
public List<Application> getGadgetsOfCategory(final ApplicationCategory appCategory) throws Exception {
  List<Application> listGadgets=gadgets.get(appCategory);
  if (listGadgets == null || listGadgets.size() == 0) {
    return null;
  }
  Collections.sort(listGadgets,new Comparator<Application>(){
    public int compare(    Application app1,    Application app2){
      return app1.getDisplayName().compareToIgnoreCase(app2.getDisplayName());
    }
  }
);
  return listGadgets;
}
Program: 101125
Project: 101125
Buggy source:
public void execute(Event<UILanguageSelector> event) throws Exception {
  String language=event.getRequestContext().getRequestParameter("String_Node_Str");
  UIPortalApplication uiApp=Util.getUIPortalApplication();
  UIMaskWorkspace uiMaskWS=uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
  uiMaskWS.setUIComponent(null);
  Util.getPortalRequestContext().setFullRender(false);
  if (language == null || language.trim().length() < 1)   return;
  LocaleConfigService localeConfigService=event.getSource().getApplicationComponent(LocaleConfigService.class);
  LocaleConfig localeConfig=localeConfigService.getLocaleConfig(language);
  if (localeConfig == null)   localeConfig=localeConfigService.getDefaultLocaleConfig();
  uiApp.setLocale(localeConfig.getLocale());
  UIPortal uiPortal=uiApp.findFirstComponentOfType(UIPortal.class);
  uiPortal.refreshNavigation(localeConfig.getLocale());
  OrganizationService orgService=event.getSource().getApplicationComponent(OrganizationService.class);
  String remoteUser=event.getRequestContext().getRemoteUser();
  if (remoteUser != null) {
    UserProfile userProfile=orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
    userProfile.getUserInfoMap().put("String_Node_Str",language);
  }
}

Fixed version (ground truth):
public void execute(Event<UILanguageSelector> event) throws Exception {
  String language=event.getRequestContext().getRequestParameter("String_Node_Str");
  UIPortalApplication uiApp=Util.getUIPortalApplication();
  UIMaskWorkspace uiMaskWS=uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
  uiMaskWS.setUIComponent(null);
  Util.getPortalRequestContext().setFullRender(false);
  if (language == null || language.trim().length() < 1)   return;
  LocaleConfigService localeConfigService=event.getSource().getApplicationComponent(LocaleConfigService.class);
  LocaleConfig localeConfig=localeConfigService.getLocaleConfig(language);
  if (localeConfig == null)   localeConfig=localeConfigService.getDefaultLocaleConfig();
  uiApp.setLocale(localeConfig.getLocale());
  UIPortal uiPortal=uiApp.findFirstComponentOfType(UIPortal.class);
  uiPortal.refreshNavigation(localeConfig.getLocale());
  OrganizationService orgService=event.getSource().getApplicationComponent(OrganizationService.class);
  String remoteUser=event.getRequestContext().getRemoteUser();
  if (remoteUser != null) {
    UserProfile userProfile=orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
    userProfile.getUserInfoMap().put("String_Node_Str",language);
    UserProfileHandler hanlder=orgService.getUserProfileHandler();
    hanlder.saveUserProfile(userProfile,true);
  }
}
Program: 101126
Project: 101126
Buggy source:
public UIIFrameEditMode() throws Exception {
  PortletRequestContext pcontext=(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
  PortletPreferences pref=pcontext.getRequest().getPreferences();
  addUIFormInput(new UIFormStringInput(FIELD_URL,FIELD_URL,pref.getValue("String_Node_Str","String_Node_Str")).addValidator(MandatoryValidator.class).addValidator(URLValidator.class));
}

Fixed version (ground truth):
public UIIFrameEditMode() throws Exception {
  PortletRequestContext pcontext=(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
  PortletPreferences pref=pcontext.getRequest().getPreferences();
  addUIFormInput(new UIFormStringInput(FIELD_URL,FIELD_URL,pref.getValue("String_Node_Str","String_Node_Str")));
}
Program: 101127
Project: 101127
Buggy source:
public void execute(Event<UIIFrameEditMode> event) throws Exception {
  UIIFrameEditMode uiForm=event.getSource();
  PortletRequestContext pcontext=(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
  PortletPreferences pref=pcontext.getRequest().getPreferences();
  pref.setValue("String_Node_Str",uiForm.getUIStringInput(FIELD_URL).getValue());
  pref.store();
  pcontext.setApplicationMode(PortletMode.VIEW);
}

Fixed version (ground truth):
public void execute(Event<UIIFrameEditMode> event) throws Exception {
  UIIFrameEditMode uiForm=event.getSource();
  String url=uiForm.getUIStringInput(FIELD_URL).getValue();
  UIIFramePortlet uiPortlet=uiForm.getParent();
  if (url == null || url.length() == 0) {
    Object args[]={uiForm.getLabel(uiForm.getUIStringInput(FIELD_URL).getId())};
    uiPortlet.addMessage(new ApplicationMessage("String_Node_Str",args));
    uiForm.getUIStringInput(FIELD_URL).setValue(uiPortlet.getURL());
    return;
  }
  if (!url.trim().matches(URLValidator.URL_REGEX)) {
    uiForm.getUIStringInput(FIELD_URL).setValue(uiPortlet.getURL());
    Object[] args={FIELD_URL,"String_Node_Str"};
    throw new MessageException(new ApplicationMessage("String_Node_Str",args));
  }
  PortletRequestContext pcontext=(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
  PortletPreferences pref=pcontext.getRequest().getPreferences();
  pref.setValue("String_Node_Str",uiForm.getUIStringInput(FIELD_URL).getValue());
  pref.store();
  pcontext.setApplicationMode(PortletMode.VIEW);
}
Program: 101128
Project: 101128
Buggy source:
public void execute(Event<UIForgetPassword> event) throws Exception {
  UILogin uilogin=event.getSource().getParent();
  uilogin.getChild(UILoginForm.class).setRendered(false);
  uilogin.getChild(UIForgetPasswordWizard.class).setRendered(true);
  uilogin.getChild(UIForgetPassword.class).setRendered(false);
  event.getRequestContext().addUIComponentToUpdateByAjax(uilogin);
}

Fixed version (ground truth):
public void execute(Event<UIForgetPassword> event) throws Exception {
  UILogin uilogin=event.getSource().getParent();
  uilogin.getChild(UILoginForm.class).setRendered(false);
  uilogin.getChild(UIForgetPasswordWizard.class).setRendered(true);
  uilogin.getChild(UIForgetPassword.class).setRendered(false);
  event.getSource().reset();
  event.getRequestContext().addUIComponentToUpdateByAjax(uilogin);
}
Program: 101129
Project: 101129
Buggy source:
public byte[] getUploadData() throws Exception {
  if (uploadResource_ == null)   return null;
  File file=new File(uploadResource_.getStoreLocation());
  FileInputStream inputStream=new FileInputStream(file);
  FileChannel fchan=inputStream.getChannel();
  long fsize=fchan.size();
  ByteBuffer buff=ByteBuffer.allocate((int)fsize);
  fchan.read(buff);
  buff.rewind();
  byte[] data=buff.array();
  buff.clear();
  fchan.close();
  inputStream.close();
  return data;
}

Fixed version (ground truth):
@Deprecated public byte[] getUploadData() throws Exception {
  if (uploadResource_ == null)   return null;
  File file=new File(uploadResource_.getStoreLocation());
  FileInputStream inputStream=new FileInputStream(file);
  FileChannel fchan=inputStream.getChannel();
  long fsize=fchan.size();
  ByteBuffer buff=ByteBuffer.allocate((int)fsize);
  fchan.read(buff);
  buff.rewind();
  byte[] data=buff.array();
  buff.clear();
  fchan.close();
  inputStream.close();
  return data;
}
Program: 101130
Project: 101130
Buggy source:
public boolean isSelected(Object obj) throws Exception {
  if (selected == null)   return false;
  return obj.equals(selected);
}

Fixed version (ground truth):
public boolean isSelected(Object obj) throws Exception {
  if (selected == null)   return false;
  return getId(obj).equals(getId(selected));
}
Program: 101132
Project: 101132
Buggy source:
public void execute(final Event<UIAddGadgetForm> event) throws Exception {
  WebuiRequestContext context=event.getRequestContext();
  UIAddGadgetForm uiForm=event.getSource();
  UIDashboard uiDashboard=uiForm.getAncestorOfType(UIDashboard.class);
  UIDashboardContainer uiContainer=uiDashboard.getChild(UIDashboardContainer.class);
  GadgetRegistryService service=uiForm.getApplicationComponent(GadgetRegistryService.class);
  String url=uiForm.getUIStringInput(FIELD_URL).getValue();
  String name="String_Node_Str" + url.hashCode();
  Gadget gadget=GadgetUtil.toGadget(name,url,false);
  service.saveGadget(gadget);
  StringBuilder windowId=new StringBuilder(PortalConfig.USER_TYPE);
  windowId.append("String_Node_Str").append(context.getRemoteUser());
  windowId.append("String_Node_Str").append(gadget.getName()).append('/');
  UIGadget uiGadget=uiForm.createUIComponent(context,UIGadget.class,null,null);
  uiGadget.setId(Integer.toString(uiGadget.hashCode() + 1));
  windowId.append(uiGadget.hashCode());
  uiGadget.setApplicationInstanceId(windowId.toString());
  uiContainer.addUIGadget(uiGadget,0,0);
  uiContainer.save();
  context.addUIComponentToUpdateByAjax(uiContainer);
}

Fixed version (ground truth):
public void execute(final Event<UIAddGadgetForm> event) throws Exception {
  WebuiRequestContext context=event.getRequestContext();
  UIAddGadgetForm uiForm=event.getSource();
  UIDashboard uiDashboard=uiForm.getAncestorOfType(UIDashboard.class);
  UIDashboardContainer uiContainer=uiDashboard.getChild(UIDashboardContainer.class);
  GadgetRegistryService service=uiForm.getApplicationComponent(GadgetRegistryService.class);
  String url=uiForm.getUIStringInput(FIELD_URL).getValue();
  try {
    new URL(url);
  }
 catch (  Exception e) {
    UIApplication uiApplication=context.getUIApplication();
    uiApplication.addMessage(new ApplicationMessage("String_Node_Str",null));
    context.addUIComponentToUpdateByAjax(uiApplication.getUIPopupMessages());
    return;
  }
  String name="String_Node_Str" + url.hashCode();
  Gadget gadget=GadgetUtil.toGadget(name,url,false);
  service.saveGadget(gadget);
  StringBuilder windowId=new StringBuilder(PortalConfig.USER_TYPE);
  windowId.append("String_Node_Str").append(context.getRemoteUser());
  windowId.append("String_Node_Str").append(gadget.getName()).append('/');
  UIGadget uiGadget=uiForm.createUIComponent(context,UIGadget.class,null,null);
  uiGadget.setId(Integer.toString(uiGadget.hashCode() + 1));
  windowId.append(uiGadget.hashCode());
  uiGadget.setApplicationInstanceId(windowId.toString());
  uiContainer.addUIGadget(uiGadget,0,0);
  uiContainer.save();
  uiForm.reset();
  context.addUIComponentToUpdateByAjax(uiForm);
  context.addUIComponentToUpdateByAjax(uiContainer);
}
Program: 101133
Project: 101133
Buggy source:
public void processRender(WebuiRequestContext context) throws Exception {
  initData();
  PortalLayoutService service=getApplicationComponent(PortalLayoutService.class);
  DashboardParent parent=(DashboardParent)((UIComponent)getParent()).getParent();
  Container container=service.getContainer(ROOT_CONTAINER + "String_Node_Str" + windowId,parent.getDashboardOwner());
  UIContainer uiRoot=getChild(UIContainer.class);
  uiRoot.getChildren().clear();
  PortalDataMapper.toUIContainer(uiRoot,container);
  super.processRender(context);
}

Fixed version (ground truth):
public void processRender(WebuiRequestContext context) throws Exception {
  initData();
  PortalLayoutService service=getApplicationComponent(PortalLayoutService.class);
  DashboardParent parent=(DashboardParent)((UIComponent)getParent()).getParent();
  Container container=service.getContainer(ROOT_CONTAINER + "String_Node_Str" + windowId,parent.getDashboardOwner());
  UIContainer uiRoot=getChild(UIContainer.class);
  uiRoot.getChildren().clear();
  PortalDataMapper.toUIContainer(uiRoot,container);
  JavascriptManager jsmanager=context.getJavascriptManager();
  jsmanager.addCustomizedOnLoadScript("String_Node_Str" + windowId + "String_Node_Str");
  super.processRender(context);
}
Program: 101134
Project: 101134
Buggy source:
public final void execute(final Event<org.exoplatform.webui.core.UIContainer> event) throws Exception {
  WebuiRequestContext context=event.getRequestContext();
  org.exoplatform.webui.core.UIContainer uiPortlet=event.getSource();
  String objectId=context.getRequestParameter(OBJECTID);
  String minimized=context.getRequestParameter("String_Node_Str");
  UIGadget uiGadget=uiPortlet.getChild(UIDashboardContainer.class).getUIGadget(objectId);
  uiGadget.getProperties().setProperty("String_Node_Str",minimized);
  uiPortlet.getChild(UIDashboardContainer.class).save();
}

Fixed version (ground truth):
public final void execute(final Event<org.exoplatform.webui.core.UIContainer> event) throws Exception {
  WebuiRequestContext context=event.getRequestContext();
  org.exoplatform.webui.core.UIContainer uiPortlet=event.getSource();
  String objectId=context.getRequestParameter(OBJECTID);
  String minimized=context.getRequestParameter("String_Node_Str");
  UIGadget uiGadget=uiPortlet.getChild(UIDashboardContainer.class).getUIGadget(objectId);
  uiGadget.getProperties().setProperty("String_Node_Str",minimized);
  uiPortlet.getChild(UIDashboardContainer.class).save();
  context.addUIComponentToUpdateByAjax(uiGadget);
}
Program: 101135
Project: 101135
Buggy source:
public final List<ApplicationCategory> getCategories() throws Exception {
  ApplicationRegistryService service=getApplicationComponent(ApplicationRegistryService.class);
  service.importExoGadgets();
  String remoteUser=((WebuiRequestContext)WebuiRequestContext.getCurrentInstance()).getRemoteUser();
  List<ApplicationCategory> listCategories=service.getApplicationCategories(remoteUser,org.exoplatform.web.application.Application.EXO_GAGGET_TYPE);
  gadgets=new Hashtable<ApplicationCategory,List<Application>>();
  for (int i=0; i < listCategories.size(); i++) {
    ApplicationCategory cate=listCategories.get(i);
    List<Application> listGadgets=service.getApplications(cate,org.exoplatform.web.application.Application.EXO_GAGGET_TYPE);
    if (listGadgets == null || listGadgets.size() == 0) {
      listCategories.remove(i);
      i--;
    }
 else {
      gadgets.put(cate,listGadgets);
    }
  }
  categories=listCategories;
  return categories;
}

Fixed version (ground truth):
public final List<ApplicationCategory> getCategories() throws Exception {
  ApplicationRegistryService service=getApplicationComponent(ApplicationRegistryService.class);
  String remoteUser=((WebuiRequestContext)WebuiRequestContext.getCurrentInstance()).getRemoteUser();
  List<ApplicationCategory> listCategories=service.getApplicationCategories(remoteUser,org.exoplatform.web.application.Application.EXO_GAGGET_TYPE);
  gadgets=new Hashtable<ApplicationCategory,List<Application>>();
  for (int i=0; i < listCategories.size(); i++) {
    ApplicationCategory cate=listCategories.get(i);
    List<Application> listGadgets=service.getApplications(cate,org.exoplatform.web.application.Application.EXO_GAGGET_TYPE);
    if (listGadgets == null || listGadgets.size() == 0) {
      listCategories.remove(i);
      i--;
    }
 else {
      gadgets.put(cate,listGadgets);
    }
  }
  categories=listCategories;
  return categories;
}
Program: 101136
Project: 101136
Buggy source:
public UIGadgetEditMode() throws Exception {
  PortletRequestContext pcontext=(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
  PortletPreferences pref=pcontext.getRequest().getPreferences();
  addUIFormInput(new UIFormStringInput(FIELD_URL,FIELD_URL,pref.getValue("String_Node_Str","String_Node_Str")));
}

Fixed version (ground truth):
public UIGadgetEditMode() throws Exception {
  PortletRequestContext pcontext=(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
  PortletPreferences pref=pcontext.getRequest().getPreferences();
  List<SelectItemOption<String>> options=new ArrayList<SelectItemOption<String>>();
  options.add(new SelectItemOption<String>(REMOTE_TYPE,REMOTE_TYPE));
  options.add(new SelectItemOption<String>(LOCAL_TYPE,LOCAL_TYPE));
  UIFormSelectBox typeSelector=new UIFormSelectBox(TYPE_SELECTOR,null,options);
  typeSelector.setOnChange("String_Node_Str");
  addUIFormInput(typeSelector);
  addUIFormInput(new UIFormStringInput(FIELD_URL,FIELD_URL,pref.getValue("String_Node_Str","String_Node_Str")));
  UIFormSelectBox gadgetSelector=new UIFormSelectBox(GADGET_SELECTOR,null,new ArrayList<SelectItemOption<String>>());
  gadgetSelector.setRendered(false);
  addUIFormInput(gadgetSelector);
}
Program: 101137
Project: 101137
Buggy source:
public void execute(final Event<UIGadgetEditMode> event) throws Exception {
  UIGadgetEditMode uiGadgetEditMode=event.getSource();
  String url=uiGadgetEditMode.getUIStringInput(FIELD_URL).getValue();
  UIGadgetPortlet uiPortlet=uiGadgetEditMode.getParent();
  if (url == null || url.length() == 0) {
    uiGadgetEditMode.getUIStringInput(FIELD_URL).setValue(uiPortlet.getUrl());
    return;
  }
  try {
    PortletRequestContext pcontext=(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
    PortletPreferences pref=pcontext.getRequest().getPreferences();
    new URL(url);
    pref.setValue("String_Node_Str",url);
    pref.store();
    pcontext.setApplicationMode(PortletMode.VIEW);
  }
 catch (  Exception e) {
    uiGadgetEditMode.getUIStringInput(FIELD_URL).setValue(uiPortlet.getUrl());
  }
}

Fixed version (ground truth):
public void execute(final Event<UIGadgetEditMode> event) throws Exception {
  UIGadgetEditMode uiGadgetEdit=event.getSource();
  UIFormSelectBox typeSelector=uiGadgetEdit.getUIFormSelectBox(TYPE_SELECTOR);
  String selectedValue=typeSelector.getValue();
  UIFormStringInput urlInput=uiGadgetEdit.getUIStringInput(FIELD_URL);
  UIFormSelectBox gadgetSelector=uiGadgetEdit.getUIFormSelectBox(GADGET_SELECTOR);
  if (selectedValue.equals(REMOTE_TYPE)) {
    urlInput.setRendered(true);
    gadgetSelector.setRendered(false);
  }
 else {
    urlInput.setRendered(false);
    gadgetSelector.setRendered(true);
    List<SelectItemOption<String>> gadgetItems=gadgetSelector.getOptions();
    gadgetItems.clear();
    String userName=event.getRequestContext().getRemoteUser();
    ApplicationRegistryService service=uiGadgetEdit.getApplicationComponent(ApplicationRegistryService.class);
    UserACL acl=uiGadgetEdit.getApplicationComponent(UserACL.class);
    List<Application> appList=service.getAllApplications();
    for (    Application app : appList) {
      if (app.getApplicationType().equals(org.exoplatform.web.application.Application.EXO_GAGGET_TYPE)) {
        for (        String per : app.getAccessPermissions()) {
          if (acl.hasPermission(userName,per)) {
            gadgetItems.add(new SelectItemOption<String>(app.getDisplayName(),app.getId()));
            break;
          }
        }
      }
    }
  }
  event.getRequestContext().addUIComponentToUpdateByAjax(uiGadgetEdit);
}
Program: 101138
Project: 101138
Buggy source:
public Query(String ownerType,String ownerId,String name,Class<T> clazz){
  ownerType_=ownerType;
  ownerId_=ownerId;
  classType_=clazz;
  name_=name;
}

Fixed version (ground truth):
public Query(String ownerType,String ownerId,String name,String title,Class<T> clazz){
  ownerType_=ownerType;
  ownerId_=ownerId;
  classType_=clazz;
  name_=name;
  try {
    Method method=clazz.getMethod("String_Node_Str",null);
    if (method != null)     title_=title;
  }
 catch (  Exception e) {
  }
}
Program: 101141
Project: 101141
Buggy source:
public Query(String ownerType,String ownerId,String name,String title,Class<T> clazz){
  ownerType_=ownerType;
  ownerId_=ownerId;
  classType_=clazz;
  name_=name;
  try {
    Method method=clazz.getMethod("String_Node_Str",null);
    if (method != null)     title_=title;
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public Query(String ownerType,String ownerId,String name,String title,Class<T> clazz){
  ownerType_=ownerType;
  ownerId_=ownerId;
  classType_=clazz;
  name_=name;
  title_=title;
}
Program: 101143
Project: 101143
Buggy source:
public void execute(Event<UIDropDownControl> event) throws Exception {
  String id=event.getRequestContext().getRequestParameter(OBJECTID);
  UIDropDownControl uiDropDownControl=event.getSource();
  UIPageNodeSelector uiPageNodeSelector=uiDropDownControl.getParent();
  event.getRequestContext().addUIComponentToUpdateByAjax(uiPageNodeSelector.getParent());
  if (id != null)   uiPageNodeSelector.selectNavigation(Integer.parseInt(id));
}

Fixed version (ground truth):
public void execute(Event<UIDropDownControl> event) throws Exception {
  String id=event.getRequestContext().getRequestParameter(OBJECTID);
  UIDropDownControl uiDropDownControl=event.getSource();
  UIPageNodeSelector uiPageNodeSelector=uiDropDownControl.getParent();
  event.getRequestContext().addUIComponentToUpdateByAjax(uiPageNodeSelector.getParent());
  if (id != null)   uiPageNodeSelector.selectNavigation(Integer.parseInt(id));
  uiPageNodeSelector.<UIComponent>getParent().broadcast(event,event.getExecutionPhase());
}
Program: 101144
Project: 101144
Buggy source:
public void processRender(WebuiRequestContext context) throws Exception {
  super.processRender(context);
}

Fixed version (ground truth):
public void processRender(WebuiRequestContext context) throws Exception {
  if (isEditMode && getChild(UIPageNodeSelector.class).getSelectedPageNode() == null)   reset();
  super.processRender(context);
}
Program: 101145
Project: 101145
Buggy source:
public void execute(Event<UIWizardPageSetInfo> event) throws Exception {
  UIWizardPageSetInfo uiForm=event.getSource();
  boolean isCheck=uiForm.getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked();
  uiForm.getUIFormDateTimeInput(START_PUBLICATION_DATE).setRendered(isCheck);
  uiForm.getUIFormDateTimeInput(END_PUBLICATION_DATE).setRendered(isCheck);
  UIWizard uiWizard=uiForm.getAncestorOfType(UIWizard.class);
  event.getRequestContext().addUIComponentToUpdateByAjax(uiWizard);
}

Fixed version (ground truth):
public void execute(Event<UIDropDownControl> event) throws Exception {
  UIDropDownControl uiDropDownControl=event.getSource();
  UIWizardPageSetInfo uiForm=uiDropDownControl.getAncestorOfType(UIWizardPageSetInfo.class);
  if (uiForm.isEditMode()) {
    uiForm.reset();
    uiForm.setShowPublicationDate(false);
  }
}
Program: 101146
Project: 101146
Buggy source:
public void reset(){
  super.reset();
  getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).setChecked(false);
  getUIFormDateTimeInput(START_PUBLICATION_DATE).setRendered(false);
  getUIFormDateTimeInput(END_PUBLICATION_DATE).setRendered(false);
}

Fixed version (ground truth):
public void reset(){
  super.reset();
}
Program: 101147
Project: 101147
Buggy source:
public void execute(Event<UILanguageSelector> event) throws Exception {
  String language=event.getRequestContext().getRequestParameter("String_Node_Str");
  UIPortalApplication uiApp=Util.getUIPortalApplication();
  UIMaskWorkspace uiMaskWS=uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
  uiMaskWS.setUIComponent(null);
  Util.getPortalRequestContext().setFullRender(false);
  if (language == null || language.trim().length() < 1)   return;
  LocaleConfigService localeConfigService=event.getSource().getApplicationComponent(LocaleConfigService.class);
  LocaleConfig localeConfig=localeConfigService.getLocaleConfig(language);
  if (localeConfig == null)   localeConfig=localeConfigService.getDefaultLocaleConfig();
  uiApp.setLocale(localeConfig.getLocale());
  UIPortal uiPortal=uiApp.findFirstComponentOfType(UIPortal.class);
  uiPortal.refreshNavigation(localeConfig.getLanguage());
  OrganizationService orgService=event.getSource().getApplicationComponent(OrganizationService.class);
  String remoteUser=event.getRequestContext().getRemoteUser();
  if (remoteUser != null) {
    UserProfile userProfile=orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
    userProfile.getUserInfoMap().put("String_Node_Str",language);
  }
}

Fixed version (ground truth):
public void execute(Event<UILanguageSelector> event) throws Exception {
  String language=event.getRequestContext().getRequestParameter("String_Node_Str");
  UIPortalApplication uiApp=Util.getUIPortalApplication();
  UIMaskWorkspace uiMaskWS=uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
  uiMaskWS.setUIComponent(null);
  Util.getPortalRequestContext().setFullRender(false);
  if (language == null || language.trim().length() < 1)   return;
  LocaleConfigService localeConfigService=event.getSource().getApplicationComponent(LocaleConfigService.class);
  LocaleConfig localeConfig=localeConfigService.getLocaleConfig(language);
  if (localeConfig == null)   localeConfig=localeConfigService.getDefaultLocaleConfig();
  uiApp.setLocale(localeConfig.getLocale());
  UIPortal uiPortal=uiApp.findFirstComponentOfType(UIPortal.class);
  uiPortal.refreshNavigation(localeConfig.getLocale());
  OrganizationService orgService=event.getSource().getApplicationComponent(OrganizationService.class);
  String remoteUser=event.getRequestContext().getRemoteUser();
  if (remoteUser != null) {
    UserProfile userProfile=orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
    userProfile.getUserInfoMap().put("String_Node_Str",language);
  }
}
Program: 101148
Project: 101148
Buggy source:
public void refreshNavigation(String lcl){
  LocaleConfig localeConfig=getApplicationComponent(LocaleConfigService.class).getLocaleConfig(lcl);
  for (  PageNavigation nav : navigations) {
    if (nav.getOwnerType().equals(PortalConfig.USER_TYPE))     continue;
    ResourceBundle res=localeConfig.getNavigationResourceBundle(nav.getOwnerType(),nav.getOwnerId());
    for (    PageNode node : nav.getNodes()) {
      resolveLabel(res,node);
    }
  }
}

Fixed version (ground truth):
public void refreshNavigation(Locale locale){
  LocaleConfig localeConfig=getApplicationComponent(LocaleConfigService.class).getLocaleConfig(locale.getLanguage());
  for (  PageNavigation nav : navigations) {
    if (nav.getOwnerType().equals(PortalConfig.USER_TYPE))     continue;
    ResourceBundle res=localeConfig.getNavigationResourceBundle(nav.getOwnerType(),nav.getOwnerId());
    for (    PageNode node : nav.getNodes()) {
      resolveLabel(res,node);
    }
  }
}
Program: 101149
Project: 101149
Buggy source:
public void setNavigation(List<PageNavigation> navs) throws Exception {
  navigations=navs;
  selectedPaths_=new ArrayList<PageNode>();
  if (navigations == null || navigations.size() < 1)   return;
  PageNavigation pNav=navigations.get(0);
  if (pNav.getNodes() == null || pNav.getNodes().size() < 1)   return;
  selectedNode_=pNav.getNodes().get(0);
  selectedPaths_.add(selectedNode_);
  UIPageBody uiPageBody=findFirstComponentOfType(UIPageBody.class);
  if (uiPageBody == null)   return;
  uiPageBody.setPageBody(selectedNode_,this);
  refreshNavigation();
}

Fixed version (ground truth):
public void setNavigation(List<PageNavigation> navs) throws Exception {
  navigations=navs;
  selectedPaths_=new ArrayList<PageNode>();
  if (navigations == null || navigations.size() < 1)   return;
  PageNavigation pNav=navigations.get(0);
  if (pNav.getNodes() == null || pNav.getNodes().size() < 1)   return;
  selectedNode_=pNav.getNodes().get(0);
  selectedPaths_.add(selectedNode_);
  UIPageBody uiPageBody=findFirstComponentOfType(UIPageBody.class);
  if (uiPageBody == null)   return;
  uiPageBody.setPageBody(selectedNode_,this);
  UIPortalApplication uiApp=Util.getUIPortalApplication();
  refreshNavigation(uiApp.getLocale());
}
Program: 101152
Project: 101152
Buggy source:
public void loadSelectedPath(){
  List<PageNode> nodes=Util.getUIPortal().getSelectedPaths();
  List<LocalPath> paths=new ArrayList<LocalPath>();
  for (  PageNode node : nodes) {
    paths.add(new LocalPath(node.getUri(),node.getResolvedLabel()));
  }
  UIBreadcumbs uiBreadCumbs=getChild(UIBreadcumbs.class);
  uiBreadCumbs.setPath(paths);
}

Fixed version (ground truth):
public void loadSelectedPath(){
  List<PageNode> nodes=Util.getUIPortal().getSelectedPaths();
  List<LocalPath> paths=new ArrayList<LocalPath>();
  for (  PageNode node : nodes) {
    if (node.getPageReference() == null) {
      paths.add(new LocalPath(null,node.getResolvedLabel()));
    }
 else {
      paths.add(new LocalPath(node.getUri(),node.getResolvedLabel()));
    }
  }
  UIBreadcumbs uiBreadCumbs=getChild(UIBreadcumbs.class);
  uiBreadCumbs.setPath(paths);
}
Program: 101153
Project: 101153
Buggy source:
public NewPortalConfigListener(DataStorage pdcService,ConfigurationManager cmanager,InitParams params) throws Exception {
  cmanager_=cmanager;
  pdcService_=pdcService;
  ObjectParameter objectParam=params.getObjectParam("String_Node_Str");
  if (objectParam != null)   pageTemplateConfig_=(PageTemplateConfig)objectParam.getObject();
  String checkPortal="String_Node_Str";
  ValueParam valueParam=params.getValueParam("String_Node_Str");
  if (valueParam != null)   checkPortal=valueParam.getValue();
  if (checkPortal == null || checkPortal.trim().length() == 0)   checkPortal="String_Node_Str";
  if (isInitedDB(checkPortal))   return;
  configs=params.getObjectParamValues(NewPortalConfig.class);
  for (  Object ele : configs) {
    NewPortalConfig portalConfig=(NewPortalConfig)ele;
    if (portalConfig.getOwnerType().equals("String_Node_Str")) {
      initUserTypeDB(portalConfig);
    }
 else     if (portalConfig.getOwnerType().equals(PortalConfig.GROUP_TYPE)) {
      initGroupTypeDB(portalConfig);
    }
 else {
      initPortalTypeDB(portalConfig);
    }
    portalConfig.getPredefinedOwner().clear();
  }
}

Fixed version (ground truth):
public NewPortalConfigListener(DataStorage pdcService,ConfigurationManager cmanager,InitParams params) throws Exception {
  cmanager_=cmanager;
  pdcService_=pdcService;
  ObjectParameter objectParam=params.getObjectParam("String_Node_Str");
  if (objectParam != null)   pageTemplateConfig_=(PageTemplateConfig)objectParam.getObject();
  String checkPortal="String_Node_Str";
  ValueParam valueParam=params.getValueParam("String_Node_Str");
  if (valueParam != null)   checkPortal=valueParam.getValue();
  if (checkPortal == null || checkPortal.trim().length() == 0)   checkPortal="String_Node_Str";
  configs=params.getObjectParamValues(NewPortalConfig.class);
  if (isInitedDB(checkPortal))   return;
  for (  Object ele : configs) {
    NewPortalConfig portalConfig=(NewPortalConfig)ele;
    if (portalConfig.getOwnerType().equals("String_Node_Str")) {
      initUserTypeDB(portalConfig);
    }
 else     if (portalConfig.getOwnerType().equals(PortalConfig.GROUP_TYPE)) {
      initGroupTypeDB(portalConfig);
    }
 else {
      initPortalTypeDB(portalConfig);
    }
    portalConfig.getPredefinedOwner().clear();
  }
}
Program: 101154
Project: 101154
Buggy source:
public PortalRequestContext(WebuiApplication app,HttpServletRequest req,HttpServletResponse res) throws Exception {
  super(app);
  request_=req;
  response_=res;
  setSessionId(req.getSession().getId());
  ajaxRequest_="String_Node_Str".equals(req.getParameter("String_Node_Str"));
  String cache=req.getParameter(CACHE_LEVEL);
  if (cache != null)   cacheLevel_=cache;
  nodeURI_=req.getRequestURI();
  String pathInfo=req.getPathInfo();
  if (pathInfo == null)   pathInfo="String_Node_Str";
  int colonIndex=pathInfo.indexOf("String_Node_Str",1);
  if (colonIndex < 0)   colonIndex=pathInfo.length();
  portalOwner_=pathInfo.substring(1,colonIndex);
  nodePath_=pathInfo.substring(colonIndex,pathInfo.length());
  portalURI=nodeURI_.substring(0,nodeURI_.lastIndexOf(nodePath_)) + "String_Node_Str";
  if (nodeURI_.indexOf("String_Node_Str") >= 0)   accessPath=PUBLIC_ACCESS;
 else   if (nodeURI_.indexOf("String_Node_Str") >= 0)   accessPath=PRIVATE_ACCESS;
  response_.setContentType("String_Node_Str");
  try {
    request_.setCharacterEncoding("String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    log.error("String_Node_Str",e);
  }
  urlBuilder=new PortalURLBuilder(nodeURI_);
}

Fixed version (ground truth):
public PortalRequestContext(WebuiApplication app,HttpServletRequest req,HttpServletResponse res) throws Exception {
  super(app);
  request_=req;
  response_=res;
  setSessionId(req.getSession().getId());
  ajaxRequest_="String_Node_Str".equals(req.getParameter("String_Node_Str"));
  String cache=req.getParameter(CACHE_LEVEL);
  if (cache != null)   cacheLevel_=cache;
  requestURI_=URLDecoder.decode(req.getRequestURI(),"String_Node_Str");
  String pathInfo=req.getPathInfo();
  if (pathInfo == null)   pathInfo="String_Node_Str";
  int colonIndex=pathInfo.indexOf("String_Node_Str",1);
  if (colonIndex < 0)   colonIndex=pathInfo.length();
  portalOwner_=pathInfo.substring(1,colonIndex);
  nodePath_=pathInfo.substring(colonIndex,pathInfo.length());
  portalURI=requestURI_.substring(0,requestURI_.lastIndexOf(nodePath_)) + "String_Node_Str";
  if (requestURI_.indexOf("String_Node_Str") >= 0)   accessPath=PUBLIC_ACCESS;
 else   if (requestURI_.indexOf("String_Node_Str") >= 0)   accessPath=PRIVATE_ACCESS;
  response_.setContentType("String_Node_Str");
  try {
    request_.setCharacterEncoding("String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    log.error("String_Node_Str",e);
  }
  urlBuilder=new PortalURLBuilder(requestURI_);
}
Program: 101158
Project: 101158
Buggy source:
public void setMode(ManagementMode mode,Event<? extends UIComponent> event) throws Exception {
  mode_=mode;
  if (mode == ManagementMode.EDIT) {
    UIPageNodeSelector uiNodeSelector=getChild(UIPageNodeSelector.class);
    UITree uiTree=uiNodeSelector.getChild(UITree.class);
    getChild(UIDescription.class).setRendered(false);
    uiTree.createEvent("String_Node_Str",event.getExecutionPhase(),event.getRequestContext()).broadcast();
    return;
  }
  UIWorkingWorkspace uiWorkingWS=Util.updateUIApplication(event);
  getChild(UIPageNodeSelector.class).setRendered(false);
  getChild(UIPageNavigationControlBar.class).setRendered(false);
  getChild(UIDescription.class).setRendered(true);
  UIPortalToolPanel uiToolPanel=uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
  uiToolPanel.setShowMaskLayer(false);
  UIPageBrowser uiPageBrowser=uiToolPanel.createUIComponent(UIPageBrowser.class,null,null);
  uiToolPanel.setUIComponent(uiPageBrowser);
  uiPageBrowser.setShowAddNewPage(true);
  uiWorkingWS.setRenderedChild(UIPortalToolPanel.class);
}

Fixed version (ground truth):
public void setMode(ManagementMode mode,Event<? extends UIComponent> event) throws Exception {
  mode_=mode;
  if (mode == ManagementMode.EDIT) {
    UIPageNodeSelector uiNodeSelector=getChild(UIPageNodeSelector.class);
    UITree uiTree=uiNodeSelector.getChild(UITree.class);
    getChild(UIDescription.class).setRendered(false);
    uiTree.createEvent("String_Node_Str",event.getExecutionPhase(),event.getRequestContext()).broadcast();
    return;
  }
  UIWorkingWorkspace uiWorkingWS=Util.updateUIApplication(event);
  getChild(UIPageNodeSelector.class).setRendered(false);
  getChild(UIPageNavigationControlBar.class).setRendered(false);
  getChild(UIDescription.class).setRendered(true);
  UIPortalToolPanel uiToolPanel=uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
  uiToolPanel.setShowMaskLayer(false);
  UIPageBrowser uiPageBrowser=uiToolPanel.findFirstComponentOfType(UIPageBrowser.class);
  if (uiPageBrowser == null)   uiPageBrowser=uiToolPanel.createUIComponent(UIPageBrowser.class,null,null);
  uiToolPanel.setUIComponent(uiPageBrowser);
  uiPageBrowser.setShowAddNewPage(true);
  uiWorkingWS.setRenderedChild(UIPortalToolPanel.class);
}
Program: 101159
Project: 101159
Buggy source:
public void execute(Event<UIPageBrowseControlBar> event) throws Exception {
  UIPageBrowseControlBar uiBrowseControlBar=event.getSource();
  UIPageManagement pageManagement=uiBrowseControlBar.getParent();
  UIPageEditBar uiEditBar=pageManagement.getChild(UIPageEditBar.class);
  uiEditBar.savePage();
  UIPortalToolPanel uiToolPanel=Util.getUIPortalToolPanel();
  uiToolPanel.setShowMaskLayer(false);
  UIPageBrowser uiPageBrowser=(UIPageBrowser)uiBrowseControlBar.getBackComponent();
  uiPageBrowser.reset();
  uiToolPanel.setUIComponent(uiPageBrowser);
  UIPortalApplication uiPortalApp=event.getSource().getAncestorOfType(UIPortalApplication.class);
  UIWorkingWorkspace uiWorkingWS=uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
  event.getRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
  UIPageManagement uiManagement=uiBrowseControlBar.getParent();
  uiManagement.setRenderedChild(UIDescription.class);
  uiManagement.setMode(ManagementMode.BROWSE,event);
  event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
}

Fixed version (ground truth):
public void execute(Event<UIPageBrowseControlBar> event) throws Exception {
  UIPageBrowseControlBar uiBrowseControlBar=event.getSource();
  UIPageManagement pageManagement=uiBrowseControlBar.getParent();
  UIPageEditBar uiEditBar=pageManagement.getChild(UIPageEditBar.class);
  uiEditBar.savePage();
  UIPortalToolPanel uiToolPanel=Util.getUIPortalToolPanel();
  uiToolPanel.setShowMaskLayer(false);
  UIPageBrowser uiPageBrowser=(UIPageBrowser)uiBrowseControlBar.getBackComponent();
  uiPageBrowser.defaultValue(uiPageBrowser.getLastQuery());
  uiToolPanel.setUIComponent(uiPageBrowser);
  UIPortalApplication uiPortalApp=event.getSource().getAncestorOfType(UIPortalApplication.class);
  UIWorkingWorkspace uiWorkingWS=uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
  event.getRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
  UIPageManagement uiManagement=uiBrowseControlBar.getParent();
  uiManagement.setRenderedChild(UIDescription.class);
  event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
}
Program: 101160
Project: 101160
Buggy source:
public void setPageBody(PageNode pageNode,UIPortal uiPortal) throws Exception {
  WebuiRequestContext context=Util.getPortalRequestContext();
  ExoContainer appContainer=context.getApplication().getApplicationServiceContainer();
  UserPortalConfigService userPortalConfigService=(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
  Page page=null;
  UIPage uiPage=null;
  if (pageNode != null) {
    try {
      page=userPortalConfigService.getPage(pageNode.getPageReference(),context.getRemoteUser());
    }
 catch (    Exception e) {
      UIPortalApplication uiApp=getAncestorOfType(UIPortalApplication.class);
      uiApp.addMessage(new ApplicationMessage(e.getMessage(),new Object[]{}));
    }
  }
  if (page != null) {
    if (Page.DESKTOP_PAGE.equals(page.getFactoryId())) {
      uiPage=createUIComponent(context,UIDesktopPage.class,null,null);
    }
 else {
      uiPage=createUIComponent(context,UIPage.class,null,null);
    }
    PortalDataMapper.toUIPage(uiPage,page);
    if (uiPage.isShowMaxWindow()) {
      uiPortal.setMaximizedUIComponent(uiPage);
    }
 else {
      uiPortal.setMaximizedUIComponent(null);
    }
  }
  setUIComponent(uiPage);
}

Fixed version (ground truth):
public void setPageBody(PageNode pageNode,UIPortal uiPortal) throws Exception {
  WebuiRequestContext context=Util.getPortalRequestContext();
  ExoContainer appContainer=context.getApplication().getApplicationServiceContainer();
  UserPortalConfigService userPortalConfigService=(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
  Page page=null;
  UIPage uiPage=null;
  if (pageNode != null) {
    try {
      if (pageNode.getPageReference() != null) {
        page=userPortalConfigService.getPage(pageNode.getPageReference(),context.getRemoteUser());
      }
    }
 catch (    Exception e) {
      UIPortalApplication uiApp=getAncestorOfType(UIPortalApplication.class);
      uiApp.addMessage(new ApplicationMessage(e.getMessage(),new Object[]{}));
    }
  }
  if (page != null) {
    if (Page.DESKTOP_PAGE.equals(page.getFactoryId())) {
      uiPage=createUIComponent(context,UIDesktopPage.class,null,null);
    }
 else {
      uiPage=createUIComponent(context,UIPage.class,null,null);
    }
    PortalDataMapper.toUIPage(uiPage,page);
    if (uiPage.isShowMaxWindow()) {
      uiPortal.setMaximizedUIComponent(uiPage);
    }
 else {
      uiPortal.setMaximizedUIComponent(null);
    }
  }
  setUIComponent(uiPage);
}
Program: 101161
Project: 101161
Buggy source:
public void setVisible(boolean b){
  visible=b;
}

Fixed version (ground truth):
public void setVisible(Boolean b){
  visible=b.booleanValue();
}