Not to choke if we can't resolve a resource bundle.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1320 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-04-30 17:45:27 +00:00
parent 4ec673e6c2
commit d026daa466
2 changed files with 23 additions and 6 deletions
@@ -1,10 +1,11 @@
//
// $Id: MessageManager.java,v 1.1 2002/01/29 20:44:35 mdb Exp $
// $Id: MessageManager.java,v 1.2 2002/04/30 17:45:27 mdb Exp $
package com.threerings.util;
import java.util.HashMap;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
@@ -80,13 +81,17 @@ public class MessageManager
// if it's not cached, we'll need to resolve it
String fqpath = _prefix + path;
ResourceBundle rbundle = ResourceBundle.getBundle(fqpath, _locale);
if (rbundle == null) {
ResourceBundle rbundle = null;
try {
rbundle = ResourceBundle.getBundle(fqpath, _locale);
} catch (MissingResourceException mre) {
Log.warning("Unable to resolve resource bundle " +
"[path=" + fqpath + "].");
"[path=" + fqpath + ", locale=" + _locale + "].");
}
// create our message bundle, cache it and return it
// create our message bundle, cache it and return it (if we
// couldn't resolve the bundle, the message bundle will cope with
// it's null resource bundle)
bundle = new MessageBundle(path, rbundle);
_cache.put(path, bundle);
return bundle;