Fix misleading exception

This commit is contained in:
Reinhard Pointner 2017-05-26 11:48:50 +08:00
parent abc1daa809
commit ff4df3d0f7
1 changed files with 6 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import java.io.Serializable;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -150,7 +151,11 @@ public class Language implements Serializable {
} }
private static String getProperty(String key) { private static String getProperty(String key) {
try {
return ResourceBundle.getBundle(Language.class.getName()).getString(key); return ResourceBundle.getBundle(Language.class.getName()).getString(key);
} catch (MissingResourceException e) {
throw new IllegalArgumentException("Illegal language code: " + key);
}
} }
} }