Author: alexoree
Date: Thu Dec 19 00:56:37 2013
New Revision: 1552193
URL: http://svn.apache.org/r1552193
Log:
JUDDI-749 fixed trunk
Modified:
juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/resources/ResourceLoader.java
Modified:
juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/resources/ResourceLoader.java
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/resources/ResourceLoader.java?rev=1552193&r1=1552192&r2=1552193&view=diff
==============================================================================
---
juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/resources/ResourceLoader.java
(original)
+++
juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/resources/ResourceLoader.java
Thu Dec 19 00:56:37 2013
@@ -19,50 +19,57 @@ import javax.servlet.http.HttpSession;
*/
public class ResourceLoader {
- private static Map map = new HashMap();
+ private static Map map = new HashMap();
- /**
- * returns a localized string in the locale defined within
- * session.getAttribute("locale") or in the default locale, en
- *
- * @param session
- * @param key
- * @return a localized string
- * @throws IllegalArgumentException if the key is null
- * @throws MissingResourceException if the resource bundle can't be found
- */
- public static String GetResource(HttpSession session, String key) throws
MissingResourceException {
- if (key == null) {
- throw new IllegalArgumentException("key");
+ /**
+ * returns a localized string in the locale defined within
+ * session.getAttribute("locale") or in the default locale, en
+ *
+ * @param session
+ * @param key
+ * @return a localized string
+ * @throws IllegalArgumentException if the key is null
+ * @throws MissingResourceException if the resource bundle can't be
+ * found
+ */
+ public static String GetResource(HttpSession session, String key)
throws MissingResourceException {
+ if (key == null) {
+ throw new IllegalArgumentException("key");
+ }
+ String locale = "en";
+ if (session != null) {
+ locale = (String) session.getAttribute("locale");
+ }
+ if (locale==null)
+ locale = "en";
+ return GetResource(locale, key);
}
- String locale = (String) session.getAttribute("locale");
- return GetResource(locale, key);
- }
- /**
- * returns a localized string in the locale defined within locale or in the
- * default locale, en
- *
- * @param session
- * @param key
- * @return a localized string
- * @throws IllegalArgumentException if the key is null
- * @throws MissingResourceException if the resource bundle can't be found
- */
- public static String GetResource(String locale, String key) throws
MissingResourceException {
- if (key == null) {
- throw new IllegalArgumentException("key");
- }
+ /**
+ * returns a localized string in the locale defined within locale or in
+ * the default locale, en
+ *
+ * @param session
+ * @param key
+ * @return a localized string
+ * @throws IllegalArgumentException if the key is null
+ * @throws MissingResourceException if the resource bundle can't be
+ * found
+ */
+ public static String GetResource(String locale, String key) throws
MissingResourceException {
+ if (key == null) {
+ throw new IllegalArgumentException("key");
+ }
- ResourceBundle bundle = (ResourceBundle) map.get(locale);
- if (bundle == null) {
- bundle =
ResourceBundle.getBundle("org.apache.juddi.webconsole.resources.web", new
Locale(locale));
- map.put(locale, bundle);
- }
- try {
- return bundle.getString(key.trim());
- } catch (Exception ex) {
- return "key " + key + " not found " + ex.getMessage();
+ ResourceBundle bundle = (ResourceBundle) map.get(locale);
+ if (bundle == null) {
+ bundle =
ResourceBundle.getBundle("org.apache.juddi.webconsole.resources.web", new
Locale(locale));
+ map.put(locale, bundle);
+ }
+ try {
+ return bundle.getString(key.trim());
+ } catch (Exception ex) {
+ return "key " + key + " not found " + ex.getMessage();
+ }
}
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]