Program: 102482
Project: 102482
Buggy source:
private void initLanguageSelectBox(UIFormSelectBox langSelectBox){
  List<SelectItemOption<String>> lang=new ArrayList<SelectItemOption<String>>();
  LocaleConfigService localeService=getApplicationComponent(LocaleConfigService.class);
  Locale currentLocale=((PortletRequestContext)WebuiRequestContext.getCurrentInstance()).getLocale();
  Iterator<LocaleConfig> i=localeService.getLocalConfigs().iterator();
  String displayName=null;
  String language=null;
  String country=null;
  String defaultValue=null;
  SelectItemOption<String> option;
  while (i.hasNext()) {
    LocaleConfig config=i.next();
    Locale locale=config.getLocale();
    language=locale.getLanguage();
    country=locale.getCountry();
    if (country != null && country.length() > 0) {
      language=language + "String_Node_Str" + country;
    }
    ResourceBundle localeResourceBundle;
    displayName=null;
    try {
      localeResourceBundle=getResourceBundle(currentLocale);
      String key="String_Node_Str" + language;
      String translation=localeResourceBundle.getString(key);
      displayName=translation;
    }
 catch (    MissingResourceException e) {
      displayName=capitalizeFirstLetter(locale.getDisplayName(currentLocale));
    }
catch (    Exception e) {
    }
    option=new SelectItemOption<String>(displayName,language);
    if (locale.getDisplayName().equals(currentLocale.getDisplayName())) {
      option.setSelected(true);
      defaultValue=language;
    }
    lang.add(option);
  }
  Collections.sort(lang,new LanguagesComparator());
  langSelectBox.setOptions(lang);
  langSelectBox.setValue(defaultValue);
}

Fixed version (ground truth):
private void initLanguageSelectBox(UIFormSelectBox langSelectBox){
  List<SelectItemOption<String>> lang=new ArrayList<SelectItemOption<String>>();
  LocaleConfigService localeService=getApplicationComponent(LocaleConfigService.class);
  Locale currentLocale=((PortletRequestContext)WebuiRequestContext.getCurrentInstance()).getLocale();
  Iterator<LocaleConfig> i=localeService.getLocalConfigs().iterator();
  String displayName=null;
  String language=null;
  String country=null;
  String defaultValue=null;
  SelectItemOption<String> option;
  while (i.hasNext()) {
    LocaleConfig config=i.next();
    Locale locale=config.getLocale();
    language=locale.getLanguage();
    country=locale.getCountry();
    if (country != null && country.length() > 0) {
      language=language + "String_Node_Str" + country;
    }
    ResourceBundle localeResourceBundle;
    displayName=null;
    try {
      localeResourceBundle=getResourceBundle(currentLocale);
      String key="String_Node_Str" + language;
      String translation=localeResourceBundle.getString(key);
      displayName=translation;
    }
 catch (    MissingResourceException e) {
      displayName=capitalizeFirstLetter(locale.getDisplayName(currentLocale));
    }
catch (    Exception e) {
      LOG.debug("String_Node_Str");
    }
    option=new SelectItemOption<String>(displayName,language);
    if (locale.getDisplayName().equals(currentLocale.getDisplayName())) {
      option.setSelected(true);
      defaultValue=language;
    }
    lang.add(option);
  }
  Collections.sort(lang,new LanguagesComparator());
  langSelectBox.setOptions(lang);
  langSelectBox.setValue(defaultValue);
}