Author: alexoree
Date: Thu Dec 19 02:42:39 2013
New Revision: 1552212

URL: http://svn.apache.org/r1552212
Log:
JUDDI-749 fixed branch

Modified:
    
juddi/branches/juddi-3.3.x/juddi-gui/src/main/java/org/apache/juddi/webconsole/resources/ResourceLoader.java

Modified: 
juddi/branches/juddi-3.3.x/juddi-gui/src/main/java/org/apache/juddi/webconsole/resources/ResourceLoader.java
URL: 
http://svn.apache.org/viewvc/juddi/branches/juddi-3.3.x/juddi-gui/src/main/java/org/apache/juddi/webconsole/resources/ResourceLoader.java?rev=1552212&r1=1552211&r2=1552212&view=diff
==============================================================================
--- 
juddi/branches/juddi-3.3.x/juddi-gui/src/main/java/org/apache/juddi/webconsole/resources/ResourceLoader.java
 (original)
+++ 
juddi/branches/juddi-3.3.x/juddi-gui/src/main/java/org/apache/juddi/webconsole/resources/ResourceLoader.java
 Thu Dec 19 02:42:39 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]

Reply via email to