Merge branch 'develop' into update_212_Dec_merge_with_21125_chamges
[jalview.git] / src / jalview / util / MessageManager.java
index 5f6674c..a0c2cdd 100644 (file)
@@ -27,7 +27,7 @@ import java.util.ResourceBundle;
 import java.util.ResourceBundle.Control;
 import java.util.Set;
 
-import org.apache.log4j.Logger;
+import jalview.log.JLoggerLog4j;
 
 /**
  * 
@@ -40,8 +40,7 @@ public class MessageManager
 {
   private static ResourceBundle rb;
 
-  // BH 2018 switched to org.apache.llog4j.Logger
-  private static Logger log = Logger
+  private static JLoggerLog4j log = JLoggerLog4j
           .getLogger(MessageManager.class.getCanonicalName());
 
   private static Locale loc;
@@ -57,7 +56,8 @@ public class MessageManager
       // Locale.setDefault(loc);
       /* Getting messages for GV */
       log.info("Getting messages for lang: " + loc);
-      rb = ResourceBundle.getBundle("lang.Messages", Platform.getLocaleOrNone(loc), Control.getControl(Control.FORMAT_PROPERTIES));
+      Control control = Control.getControl(Control.FORMAT_PROPERTIES);
+      rb = ResourceBundle.getBundle("lang.Messages", Platform.getLocaleOrNone(loc), control);
       // if (log.isLoggable(Level.FINEST))
       // {
       // // this might take a while, so we only do it if it will be shown
@@ -93,7 +93,7 @@ public class MessageManager
     } catch (Exception e)
     {
       String msg = "I18N missing: " + loc + "\t" + key;
-    logWarning(key, msg);
+      logWarning(key, msg);
     }
     return value;
   }
@@ -161,15 +161,16 @@ public class MessageManager
    */
   public static String getStringOrReturn(String keyroot, String name)
   {
-    String smkey = keyroot + name.toLowerCase(Locale.ROOT).replaceAll(" ", "");
+    String smkey = keyroot
+            + name.toLowerCase(Locale.ROOT).replaceAll(" ", "");
     try
     {
       name = rb.getString(smkey);
     } catch (Exception x)
     {
-      String msg = "I18N missing key with root " + keyroot + ": " + loc + "\t"
-              + smkey;
-    logWarning(smkey, msg);
+      String msg = "I18N missing key with root " + keyroot + ": " + loc
+              + "\t" + smkey;
+      logWarning(smkey, msg);
     }
     return name;
   }
@@ -180,12 +181,12 @@ public class MessageManager
    * @param key
    * @param msg
    */
-  private static void logWarning(String key, String msg) 
-  {
-  if (!reportedMissing.contains(key))
+  private static void logWarning(String key, String msg)
   {
+    if (!reportedMissing.contains(key))
+    {
       reportedMissing.add(key);
-    log.info(msg);
-  }
+      log.info(msg);
+    }
   }
 }