[jboss-svn-commits] JBL Code SVN: r30958 - in labs/jbosstm/trunk/common/classes/com/arjuna/common: util/logging and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jan 6 12:30:52 EST 2010
Author: jhalliday
Date: 2010-01-06 12:30:52 -0500 (Wed, 06 Jan 2010)
New Revision: 30958
Modified:
labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/logging/Logi18nImpl.java
labs/jbosstm/trunk/common/classes/com/arjuna/common/util/logging/Logi18n.java
Log:
Remove unused support for multiple message bundles. JBTM-675
Modified: labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/logging/Logi18nImpl.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/logging/Logi18nImpl.java 2010-01-06 17:11:50 UTC (rev 30957)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/logging/Logi18nImpl.java 2010-01-06 17:30:52 UTC (rev 30958)
@@ -47,18 +47,9 @@
*/
public class Logi18nImpl implements Logi18n
{
- private ResourceBundle m_defaultResourceBundle = null;
+ private ResourceBundle m_resourceBundle = null;
/**
- * extra resource bundles (if more than one is in use)
- *
- * Note that there is a performance issue when more than one resource bundles is in use.
- *
- * @see #m_defaultResourceBundle
- */
- private ResourceBundle[] m_extraResourceBundles = null;
-
- /**
* Level for finer-debug logging.
*
* @see DebugLevel for possible values.
@@ -109,28 +100,11 @@
*
* @param bundleName The name of the resource bundle.
*/
- public synchronized void addResourceBundle(String bundleName)
+ private synchronized void addResourceBundle(String bundleName)
{
try
{
- // if no default resource bundle has been set, use this one as the default one
- if (m_defaultResourceBundle == null)
- {
- m_defaultResourceBundle = PropertyResourceBundle.getBundle(bundleName, Locale.getDefault(), Thread.currentThread().getContextClassLoader());
- }
-
- // otherwise, add it to the extra resource bundles supported by this logger
- else if (m_extraResourceBundles == null)
- {
- m_extraResourceBundles = new ResourceBundle[]{PropertyResourceBundle.getBundle(bundleName, Locale.getDefault(), Thread.currentThread().getContextClassLoader())};
- }
- else
- {
- ResourceBundle[] oldExtraResBundles = m_extraResourceBundles;
- m_extraResourceBundles = new ResourceBundle[oldExtraResBundles.length + 1];
- System.arraycopy(oldExtraResBundles, 0, m_extraResourceBundles, 0, oldExtraResBundles.length);
- m_extraResourceBundles[oldExtraResBundles.length] = PropertyResourceBundle.getBundle(bundleName, Locale.getDefault(), Thread.currentThread().getContextClassLoader());
- }
+ m_resourceBundle = PropertyResourceBundle.getBundle(bundleName, Locale.getDefault(), Thread.currentThread().getContextClassLoader());
}
catch (MissingResourceException mre)
{
@@ -400,45 +374,13 @@
synchronized String getResourceBundleString(String key) throws MissingResourceException
{
String resource = null;
- if (m_defaultResourceBundle == null)
+ if (m_resourceBundle == null)
{
- throw new MissingResourceException("no default resource bundle set for this logger", null, null);
+ throw new MissingResourceException("no resource bundle set for this logger", null, null);
}
else
{
- try
- {
- resource = m_defaultResourceBundle.getString(key);
- }
- // this exception will occur if no resource for the given key can be found.
- catch (MissingResourceException mre)
- {
- // if no extra res bundles are available, that's it. bail out!
- if (m_extraResourceBundles == null)
- {
- throw mre;
- }
- else
- {
- for (ResourceBundle bundle : m_extraResourceBundles)
- {
- try
- {
- resource = bundle.getString(key);
- }
- catch (MissingResourceException mre2)
- {
- mre = mre2;
- }
- }
- // if no resource for the given key could be found in any of the
- // resource bundles, throw an exception.
- if (resource == null)
- {
- throw mre;
- }
- }
- }
+ resource = m_resourceBundle.getString(key);
}
return resource;
}
Modified: labs/jbosstm/trunk/common/classes/com/arjuna/common/util/logging/Logi18n.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/util/logging/Logi18n.java 2010-01-06 17:11:50 UTC (rev 30957)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/util/logging/Logi18n.java 2010-01-06 17:30:52 UTC (rev 30958)
@@ -68,15 +68,7 @@
*/
public interface Logi18n
{
-
/**
- * Add the given resource bundle to this logger.
- *
- * @param bundleName The name of the resource bundle.
- */
- public void addResourceBundle(String bundleName);
-
- /**
* Determine if this logger is enabled for DEBUG messages.
*
* This method returns true when the logger's DebugLevel, VisibilityLevel and FacililityCode are all
More information about the jboss-svn-commits
mailing list