Program: 101151
Project: 101151
Buggy source:
/** 
 * The constructor of this class is used to build the tree of UI components that will be aggregated in the portal page.  1) The component is stored in the current PortalRequestContext ThreadLocal  2) The configuration for the portal associated with the current user request is extracted from the  PortalRequestContext 3) Then according to the context path, either a public or private portal is initiated. Usually a public portal does not contain the left column and only the private one has it. 4) The skin to use is setup 5) Finally, the current component is associated with the current portal owner      
 * @param initParams
 * @throws Exception
 */
public UIPortalApplication() throws Exception {
  log=ExoLogger.getLogger("String_Node_Str");
  PortalRequestContext context=PortalRequestContext.getCurrentInstance();
  context.setUIApplication(this);
  userPortalConfig_=(UserPortalConfig)context.getAttribute(UserPortalConfig.class);
  if (userPortalConfig_ == null)   throw new Exception("String_Node_Str");
  UserACL acl=getApplicationComponent(UserACL.class);
  if (acl.hasAccessControlWorkspacePermission(context.getRemoteUser()))   addChild(UIControlWorkspace.class,UIPortalApplication.UI_CONTROL_WS_ID,null);
  addWorkingWorkspace();
  String currentSkin=userPortalConfig_.getPortalConfig().getSkin();
  if (currentSkin != null && currentSkin.trim().length() > 0)   skin_=currentSkin;
  setOwner(context.getPortalOwner());
  String portalLanguage=null;
  LocaleConfigService localeConfigService=getApplicationComponent(LocaleConfigService.class);
  OrganizationService orgService=getApplicationComponent(OrganizationService.class);
  LocaleConfig localeConfig=localeConfigService.getLocaleConfig(userPortalConfig_.getPortalConfig().getLocale());
  UIPortal uiPortal=findFirstComponentOfType(UIPortal.class);
  if (context.getRemoteUser() != null) {
    UserProfile userProfile=orgService.getUserProfileHandler().findUserProfileByName(context.getRemoteUser());
    portalLanguage=userProfile.getUserInfoMap().get("String_Node_Str");
  }
  localeConfig=localeConfigService.getLocaleConfig(portalLanguage);
  if (portalLanguage != null && portalLanguage.equals(localeConfig.getLanguage())) {
    setLocale(localeConfig.getLocale());
    uiPortal.refreshNavigation(portalLanguage);
    return;
  }
  portalLanguage=context.getRequest().getLocale().getLanguage();
  localeConfig=localeConfigService.getLocaleConfig(portalLanguage);
  if (!portalLanguage.equals(localeConfig.getLanguage())) {
    localeConfig=localeConfigService.getLocaleConfig(uiPortal.getLocale());
    portalLanguage=uiPortal.getLocale();
  }
  setLocale(localeConfig.getLocale());
  uiPortal.refreshNavigation(portalLanguage);
}

Fixed version (ground truth):
/** 
 * The constructor of this class is used to build the tree of UI components that will be aggregated in the portal page.  1) The component is stored in the current PortalRequestContext ThreadLocal  2) The configuration for the portal associated with the current user request is extracted from the  PortalRequestContext 3) Then according to the context path, either a public or private portal is initiated. Usually a public portal does not contain the left column and only the private one has it. 4) The skin to use is setup 5) Finally, the current component is associated with the current portal owner      
 * @param initParams
 * @throws Exception
 */
public UIPortalApplication() throws Exception {
  log=ExoLogger.getLogger("String_Node_Str");
  PortalRequestContext context=PortalRequestContext.getCurrentInstance();
  userPortalConfig_=(UserPortalConfig)context.getAttribute(UserPortalConfig.class);
  if (userPortalConfig_ == null)   throw new Exception("String_Node_Str");
  String portalLanguage=null;
  LocaleConfigService localeConfigService=getApplicationComponent(LocaleConfigService.class);
  OrganizationService orgService=getApplicationComponent(OrganizationService.class);
  LocaleConfig localeConfig=localeConfigService.getLocaleConfig(userPortalConfig_.getPortalConfig().getLocale());
  if (context.getRemoteUser() != null) {
    UserProfile userProfile=orgService.getUserProfileHandler().findUserProfileByName(context.getRemoteUser());
    portalLanguage=userProfile.getUserInfoMap().get("String_Node_Str");
  }
  localeConfig=localeConfigService.getLocaleConfig(portalLanguage);
  if (portalLanguage == null || !portalLanguage.equals(localeConfig.getLanguage())) {
    portalLanguage=context.getRequest().getLocale().getLanguage();
    localeConfig=localeConfigService.getLocaleConfig(portalLanguage);
    if (!portalLanguage.equals(localeConfig.getLanguage())) {
      localeConfig=localeConfigService.getLocaleConfig(userPortalConfig_.getPortalConfig().getLocale());
    }
  }
  setLocale(localeConfig.getLocale());
  context.setUIApplication(this);
  UserACL acl=getApplicationComponent(UserACL.class);
  if (acl.hasAccessControlWorkspacePermission(context.getRemoteUser()))   addChild(UIControlWorkspace.class,UIPortalApplication.UI_CONTROL_WS_ID,null);
  addWorkingWorkspace();
  String currentSkin=userPortalConfig_.getPortalConfig().getSkin();
  if (currentSkin != null && currentSkin.trim().length() > 0)   skin_=currentSkin;
  setOwner(context.getPortalOwner());
}