mmidy 00/09/19 11:53:56
Modified: src/org/apache/xalan/xslt ElemNumber.java
Log:
Make resource bundle thread safe.
Revision Changes Path
1.16 +114 -80 xml-xalan/src/org/apache/xalan/xslt/ElemNumber.java
Index: ElemNumber.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/ElemNumber.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ElemNumber.java 2000/09/19 15:34:30 1.15
+++ ElemNumber.java 2000/09/19 18:53:56 1.16
@@ -129,7 +129,7 @@
public AVT m_groupingSeparator_avt = null;
public AVT m_groupingSize_avt = null;
- private XSLTResourceBundle thisBundle;
+ // private XSLTResourceBundle thisBundle;
/**
* Table to help in converting decimals to roman numerals.
@@ -237,6 +237,7 @@
try
{
+ XSLTResourceBundle thisBundle;
thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, getLocale(processor, processor.getSourceNode()) );
char[] alphabet;
alphabet= (char[]) thisBundle.getObject(Constants.LANG_ALPHABET);
@@ -861,85 +862,118 @@
case 'i':
formattedNumber.append( long2roman(listElement, true).toLowerCase(
getLocale(processor, contextNode)));
break;
- case 0x3042:
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP","HA" ) );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- formattedNumber.append( int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
- break;
- case 0x3044:
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP", "HI") );
- if ((letterVal != null) &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- formattedNumber.append( int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
- break;
- case 0x30A2:
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP","A" ) );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- formattedNumber.append( int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
- break;
- case 0x30A4:
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP", "I") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- formattedNumber.append( int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
- break;
- case 0x4E00:
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("zh","CN" ) );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- {
- formattedNumber.append(tradAlphaCount(listElement, thisBundle));
- }
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- case 0x58F9:
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("zh","TW") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- case 0x0E51:
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("th","") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- case 0x05D0:
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("he","") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- case 0x10D0:
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ka","") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- case 0x03B1:
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("el","") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- case 0x0430:
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("cy","") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
-
int2alphaCount(listElement,(char[])thisBundle.getObject(Constants.LANG_ALPHABET),
formattedNumber);
- break;
+ case 0x3042:
+ {
+ XSLTResourceBundle thisBundle;
+ thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP","HA" ) );
+ if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append( tradAlphaCount(listElement,
thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ formattedNumber.append(
int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
+ break;
+ }
+ case 0x3044:
+ {
+ XSLTResourceBundle thisBundle;
+ thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP", "HI") );
+ if ((letterVal != null) &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append( tradAlphaCount(listElement,
thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ formattedNumber.append(
int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
+ break;
+ }
+ case 0x30A2:
+ {
+ XSLTResourceBundle thisBundle;
+ thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP","A" ) );
+ if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append( tradAlphaCount(listElement,
thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ formattedNumber.append(
int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
+ break;
+ }
+ case 0x30A4:
+ {
+ XSLTResourceBundle thisBundle;
+ thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP", "I") );
+ if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append( tradAlphaCount(listElement,
thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ formattedNumber.append(
int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
+ break;
+ }
+ case 0x4E00:
+ {
+ XSLTResourceBundle thisBundle;
+ thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("zh","CN" ) );
+ if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ {
+ formattedNumber.append(tradAlphaCount(listElement,
thisBundle));
+ }
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
+ break;
+ }
+ case 0x58F9:
+ {
+ XSLTResourceBundle thisBundle;
+ thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("zh","TW") );
+ if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append( tradAlphaCount(listElement,
thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
+ break;
+ }
+ case 0x0E51:
+ {
+ XSLTResourceBundle thisBundle;
+ thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("th","") );
+ if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append( tradAlphaCount(listElement,
thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
+ break;
+ }
+ case 0x05D0:
+ {
+ XSLTResourceBundle thisBundle;
+ thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("he","") );
+ if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append( tradAlphaCount(listElement,
thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
+ break;
+ }
+ case 0x10D0:
+ {
+ XSLTResourceBundle thisBundle;
+ thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ka","") );
+ if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append( tradAlphaCount(listElement,
thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
+ break;
+ }
+ case 0x03B1:
+ {
+ XSLTResourceBundle thisBundle;
+ thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("el","") );
+ if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append( tradAlphaCount(listElement,
thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
+ break;
+ }
+ case 0x0430:
+ {
+ XSLTResourceBundle thisBundle;
+ thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("cy","") );
+ if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append( tradAlphaCount(listElement,
thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+
int2alphaCount(listElement,(char[])thisBundle.getObject(Constants.LANG_ALPHABET),
formattedNumber);
+ break;
+ }
default: // "1"
String numString = formatter.format(listElement);
int nPadding = numberWidth - numString.length();