Program: 101150
Project: 101150
Buggy source:
public void save() throws Exception {
  UIPortal uiPortal=Util.getUIPortal();
  UIPortalApplication uiPortalApp=getAncestorOfType(UIPortalApplication.class);
  PortalConfig portalConfig=PortalDataMapper.toPortal(uiPortal);
  UserPortalConfigService configService=getApplicationComponent(UserPortalConfigService.class);
  configService.update(portalConfig);
  uiPortalApp.getUserPortalConfig().setPortal(portalConfig);
  PortalRequestContext prContext=Util.getPortalRequestContext();
  String remoteUser=prContext.getRemoteUser();
  String ownerUser=prContext.getPortalOwner();
  UserPortalConfig userPortalConfig=configService.getUserPortalConfig(ownerUser,remoteUser);
  if (userPortalConfig != null) {
    uiPortal.setModifiable(userPortalConfig.getPortalConfig().isModifiable());
  }
 else {
    uiPortal.setModifiable(false);
  }
  LocaleConfigService localeConfigService=uiPortalApp.getApplicationComponent(LocaleConfigService.class);
  LocaleConfig localeConfig=localeConfigService.getLocaleConfig(portalConfig.getLocale());
  if (localeConfig == null)   localeConfig=localeConfigService.getDefaultLocaleConfig();
  uiPortalApp.setLocale(localeConfig.getLocale());
  uiPortalApp.setSkin(uiPortal.getSkin());
  prContext.refreshResourceBundle();
  SkinService skinService=getApplicationComponent(SkinService.class);
  skinService.invalidatePortalSkinCache(uiPortal.getName(),uiPortal.getSkin());
}

Fixed version (ground truth):
public void save() throws Exception {
  UIPortal uiPortal=Util.getUIPortal();
  UIPortalApplication uiPortalApp=getAncestorOfType(UIPortalApplication.class);
  PortalConfig portalConfig=PortalDataMapper.toPortal(uiPortal);
  UserPortalConfigService configService=getApplicationComponent(UserPortalConfigService.class);
  configService.update(portalConfig);
  uiPortalApp.getUserPortalConfig().setPortal(portalConfig);
  PortalRequestContext prContext=Util.getPortalRequestContext();
  String remoteUser=prContext.getRemoteUser();
  String ownerUser=prContext.getPortalOwner();
  UserPortalConfig userPortalConfig=configService.getUserPortalConfig(ownerUser,remoteUser);
  if (userPortalConfig != null) {
    uiPortal.setModifiable(userPortalConfig.getPortalConfig().isModifiable());
  }
 else {
    uiPortal.setModifiable(false);
  }
  LocaleConfigService localeConfigService=uiPortalApp.getApplicationComponent(LocaleConfigService.class);
  LocaleConfig localeConfig=localeConfigService.getLocaleConfig(portalConfig.getLocale());
  if (localeConfig == null)   localeConfig=localeConfigService.getDefaultLocaleConfig();
  String portalAppLanguage=uiPortalApp.getLocale().getLanguage();
  OrganizationService orgService=getApplicationComponent(OrganizationService.class);
  UserProfile userProfile=orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
  String userLanguage=userProfile.getUserInfoMap().get("String_Node_Str");
  String browserLanguage=prContext.getRequest().getLocale().getLanguage();
  if (!portalAppLanguage.equals(userLanguage) && !portalAppLanguage.equals(browserLanguage)) {
    uiPortalApp.setLocale(localeConfig.getLocale());
    uiPortal.refreshNavigation(localeConfig.getLocale());
  }
  uiPortalApp.setSkin(uiPortal.getSkin());
  prContext.refreshResourceBundle();
  SkinService skinService=getApplicationComponent(SkinService.class);
  skinService.invalidatePortalSkinCache(uiPortal.getName(),uiPortal.getSkin());
}