zongaro     2003/03/21 05:26:17

  Modified:    java/src/org/apache/xalan/xsltc/compiler Tag: XSLTC_DTM
                        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.19.2.14 +3 -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.19.2.13
  retrieving revision 1.19.2.14
  diff -u -r1.19.2.13 -r1.19.2.14
  --- Constants.java    3 Mar 2003 15:51:36 -0000       1.19.2.13
  +++ Constants.java    21 Mar 2003 13:26:17 -0000      1.19.2.14
  @@ -169,6 +169,8 @@
        = "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
  
  
  
  1.8.6.5   +19 -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.8.6.4
  retrieving revision 1.8.6.5
  diff -u -r1.8.6.4 -r1.8.6.5
  --- DecimalFormatting.java    30 Jan 2003 18:41:37 -0000      1.8.6.4
  +++ DecimalFormatting.java    21 Mar 2003 13:26:17 -0000      1.8.6.5
  @@ -65,6 +65,7 @@
   package org.apache.xalan.xsltc.compiler;
   
   import org.apache.bcel.generic.ConstantPoolGen;
  +import org.apache.bcel.generic.GETSTATIC;
   import org.apache.bcel.generic.INVOKESPECIAL;
   import org.apache.bcel.generic.INVOKEVIRTUAL;
   import org.apache.bcel.generic.InstructionList;
  @@ -120,8 +121,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());
  @@ -129,8 +132,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");
  @@ -239,17 +246,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]

Reply via email to