Restructure use of static field m_bundle to improve the odds that multiple instances...
[cfb.git] / prod / net / jaekl / cfb / CFB.java
index c97a1c8f7b4e74196f528b80d11bb16dfdd22884..35a08c3b178491f92e1d2c456b53a5900e64db6c 100644 (file)
@@ -60,7 +60,6 @@ public class CFB {
                m_driver = new PostgresqlDriver();
                m_schema = new CfbSchema(m_driver);
                m_locale = locale;
-               m_bundle = null;
                m_config = new Config();
                
                m_configFile = new File("config.properties");
@@ -72,12 +71,12 @@ public class CFB {
                m_output = null;
        }
        
-       CfbBundle getBundle() {
+       static CfbBundle getBundle(Locale locale) {
                CfbBundle bundle = m_bundle;
                if (null == bundle) {
                        synchronized(CFB.class) {
                                if (null == m_bundle) {
-                                       m_bundle = bundle = CfbBundle.getInst(m_locale);
+                                       m_bundle = bundle = CfbBundle.getInst(locale);
                                }
                        }
                }
@@ -153,7 +152,7 @@ public class CFB {
        }
        
        String trans(String key) {
-               return getBundle().get(key);
+               return getBundle(m_locale).get(key);
        }
        
        String getenv(String varName) {
@@ -256,12 +255,12 @@ public class CFB {
                        Analysis prior = store.getPrior(analysis);
                        Delta delta = new Delta(prior, analysis);
 
-                       HtmlReport report = new HtmlReport(getBundle(), messageMap.getColl(), delta);
+                       HtmlReport report = new HtmlReport(getBundle(m_locale), messageMap.getColl(), delta);
                        if (null != m_output) {
                                report.write(m_output);
                        }
                        
-                       Notifier notifier = new Notifier(getBundle(), m_config);
+                       Notifier notifier = new Notifier(getBundle(m_locale), m_config);
                        notifier.sendEmailIfNeeded(pw, report);
                }
                catch (StoreException exc) {