zongaro 2003/03/21 11:32:34
Modified: java/src/org/apache/xalan/xsltc/compiler Tag: xslt20
Constants.java DecimalFormatting.java
Log:
The generated code for xsl:decimal-format used the no argument constructor of
DecimalFormatSymbols, which is affected by the default locale. The default
attribute values for xsl:decimal-format should not be affected by the default
locale. Instead, the en_US Locale should be passed to the constructor, as it
has settings that are consistent with the defaults for xsl:decimal-format.
Revision Changes Path
No revision
No revision
1.24.2.1.2.4 +5 -1
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Constants.java
Index: Constants.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Constants.java,v
retrieving revision 1.24.2.1.2.3
retrieving revision 1.24.2.1.2.4
diff -u -r1.24.2.1.2.3 -r1.24.2.1.2.4
--- Constants.java 30 Jan 2003 00:39:25 -0000 1.24.2.1.2.3
+++ Constants.java 21 Mar 2003 19:32:34 -0000 1.24.2.1.2.4
@@ -165,6 +165,10 @@
= "Lorg/apache/xalan/xsltc/dom/NodeSortRecord;";
public static final String NODE_SORT_FACTORY_SIG
= "Lorg/apache/xalan/xsltc/dom/NodeSortRecordFactory;";
+ public static final String LOCALE_CLASS
+ = "java.util.Locale";
+ public static final String LOCALE_SIG
+ = "Ljava/util/Locale;";
public static final String STRING_VALUE_HANDLER
= "org.apache.xalan.xsltc.runtime.StringValueHandler";
public static final String STRING_VALUE_HANDLER_SIG
1.9.2.1.2.6 +18 -6
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/DecimalFormatting.java
Index: DecimalFormatting.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/DecimalFormatting.java,v
retrieving revision 1.9.2.1.2.5
retrieving revision 1.9.2.1.2.6
diff -u -r1.9.2.1.2.5 -r1.9.2.1.2.6
--- DecimalFormatting.java 12 Feb 2003 16:35:18 -0000 1.9.2.1.2.5
+++ DecimalFormatting.java 21 Mar 2003 19:32:34 -0000 1.9.2.1.2.6
@@ -125,8 +125,10 @@
ConstantPoolGen cpg = classGen.getConstantPool();
InstructionList il = methodGen.getInstructionList();
- // DecimalFormatSymbols.<init>();
- final int init = cpg.addMethodref(DFS_CLASS, "<init>", "()V");
+ // DecimalFormatSymbols.<init>(Locale);
+ // xsl:decimal-format - except for the NaN and infinity attributes.
+ final int init = cpg.addMethodref(DFS_CLASS, "<init>",
+ "("+LOCALE_SIG+")V");
// Push the format name on the stack for call to addDecimalFormat()
il.append(classGen.loadTranslet());
@@ -134,8 +136,12 @@
// Manufacture a DecimalFormatSymbols on the stack
// for call to addDecimalFormat()
+ // Use the US Locale as the default, as most of its settings
+ // are equivalent to the default settings required of
il.append(new NEW(cpg.addClass(DFS_CLASS)));
il.append(DUP);
+ il.append(new GETSTATIC(cpg.addFieldref(LOCALE_CLASS, "US",
+ LOCALE_SIG)));
il.append(new INVOKESPECIAL(init));
String tmp = getAttribute("NaN");
@@ -244,17 +250,23 @@
ConstantPoolGen cpg = classGen.getConstantPool();
InstructionList il = methodGen.getInstructionList();
- final int init = cpg.addMethodref(DFS_CLASS, "<init>", "()V");
+ final int init = cpg.addMethodref(DFS_CLASS, "<init>",
+ "("+LOCALE_SIG+")V");
// Push the format name, which is empty, on the stack
// for call to addDecimalFormat()
il.append(classGen.loadTranslet());
il.append(new PUSH(cpg, EMPTYSTRING));
- // Manufacture a DecimalFormatSymbols on the stack
- // for call to addDecimalFormat()
+ // Manufacture a DecimalFormatSymbols on the stack for
+ // call to addDecimalFormat(). Use the US Locale as the
+ // default, as most of its settings are equivalent to
+ // the default settings required of xsl:decimal-format -
+ // except for the NaN and infinity attributes.
il.append(new NEW(cpg.addClass(DFS_CLASS)));
il.append(DUP);
+ il.append(new GETSTATIC(cpg.addFieldref(LOCALE_CLASS, "US",
+ LOCALE_SIG)));
il.append(new INVOKESPECIAL(init));
int nan = cpg.addMethodref(DFS_CLASS,
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]