* more resilient error handling in case of illegal user locale

This commit is contained in:
Reinhard Pointner 2012-03-02 04:51:19 +00:00
parent b509f108d0
commit f7c2d8eb69
2 changed files with 18 additions and 16 deletions

View File

@ -67,7 +67,7 @@ public class Language {
try {
return new Language(code, bundle.getString(code + ".name"));
} catch (Exception e) {
return null;
return new Language(code, new Locale(code).getDisplayLanguage(Locale.ROOT));
}
}

View File

@ -235,7 +235,9 @@ public class RenamePanel extends JComponent {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value != null) {
setIcon(ResourceManager.getFlagIcon(((Language) value).getCode()));
}
return this;
}
});