You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mm...@apache.org on 2001/11/08 17:34:00 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/utils/res XResources_cy.java XResources_el.java XResources_ja_JP_A.java XResources_ja_JP_HA.java XResources_ja_JP_HI.java XResources_ja_JP_I.java XResources_zh_CN.java XResources_zh_TW.java

mmidy       01/11/08 08:34:00

  Modified:    java/src/org/apache/xalan/res XSLTErrorResources.java
               java/src/org/apache/xalan/templates ElemNumber.java
               java/src/org/apache/xml/utils/res XResources_cy.java
                        XResources_el.java XResources_ja_JP_A.java
                        XResources_ja_JP_HA.java XResources_ja_JP_HI.java
                        XResources_ja_JP_I.java XResources_zh_CN.java
                        XResources_zh_TW.java
  Log:
  Bugzilla 4601: Change ElemNumber to use a long integer for the value of the number. This will allow us to format bigger numbers. As far as japanese multipliers, we decided to document as a xalan limitation the fact that the last 2 japanese multipliers will not be supported. If anyone has a strong and valid user case for this, we will reconsider. For now, we could not justify the expense of moving to BigInteger to support these multipliers.
  
  Revision  Changes    Path
  1.23      +11 -2     xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java
  
  Index: XSLTErrorResources.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- XSLTErrorResources.java	2001/09/12 20:07:36	1.22
  +++ XSLTErrorResources.java	2001/11/08 16:34:00	1.23
  @@ -86,7 +86,7 @@
     public static final String WARNING_SUFFIX = "WR";
   
     /** Maximum error messages, this is needed to keep track of the number of messages.    */
  -  public static final int MAX_CODE = 216;          
  +  public static final int MAX_CODE = 217;          
   
     /** Maximum warnings, this is needed to keep track of the number of warnings.          */
     public static final int MAX_WARNING = 26;
  @@ -2058,7 +2058,16 @@
     {
       contents[ER_NULL_URI_NAMESPACE][1] =
        "Attempting to generate a namespace prefix with a null URI";
  -  }    
  +  }
  +  
  +  /** Attempting to generate a namespace prefix with a null URI   */
  +  public static final int ER_NUMBER_TOO_BIG = 217;
  +
  +  static
  +  {
  +    contents[ER_NUMBER_TOO_BIG][1] =
  +     "Attempting to format a number bigger than the largest Long integer";
  +  }
     
     
     /*
  
  
  
  1.22      +24 -21    xml-xalan/java/src/org/apache/xalan/templates/ElemNumber.java
  
  Index: ElemNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemNumber.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ElemNumber.java	2001/07/17 18:17:33	1.21
  +++ ElemNumber.java	2001/11/08 16:34:00	1.22
  @@ -771,23 +771,23 @@
             throws TransformerException
     {
   
  -    int[] list = null;
  +    long[] list = null;
       XPathContext xctxt = transformer.getXPathContext();
       CountersTable ctable = transformer.getCountersTable();
   
       if (null != m_valueExpr)
       {
         XObject countObj = m_valueExpr.execute(xctxt, sourceNode, this);
  -      int count = (int) java.lang.Math.floor(countObj.num()+ 0.5);
  +      long count = (long)java.lang.Math.floor(countObj.num()+ 0.5);
   
  -      list = new int[1];
  +      list = new long[1];
         list[0] = count;
       }
       else
       {
         if (Constants.NUMBERLEVEL_ANY == m_level)
         {
  -        list = new int[1];
  +        list = new long[1];
           list[0] = ctable.countNode(xctxt, this, sourceNode);
         }
         else
  @@ -799,7 +799,7 @@
   
           if (lastIndex >= 0)
           {
  -          list = new int[lastIndex + 1];
  +          list = new long[lastIndex + 1];
   
             for (int i = lastIndex; i >= 0; i--)
             {
  @@ -1106,7 +1106,7 @@
      * 
      * @param xslNumberElement Element that takes %conversion-atts; attributes.
      * @param transformer non-null reference to the the current transform-time state.
  -   * @param list Array of one or more integer numbers.
  +   * @param list Array of one or more long integer numbers.
      * @param contextNode The node that "." expresses.
      * @return String that represents list according to
      * %conversion-atts; attributes.
  @@ -1116,7 +1116,7 @@
      * @throws TransformerException
      */
     String formatNumberList(
  -          TransformerImpl transformer, int[] list, int contextNode)
  +          TransformerImpl transformer, long[] list, int contextNode)
               throws TransformerException
     {
   
  @@ -1274,7 +1274,7 @@
      */
     private void getFormattedNumber(
             TransformerImpl transformer, int contextNode, 
  -          char numberType, int numberWidth, int listElement, 
  +          char numberType, int numberWidth, long listElement, 
             FastStringBuffer formattedNumber)
               throws javax.xml.transform.TransformerException
     {
  @@ -1569,7 +1569,7 @@
      * Note that the radix of the conversion is inferred from the size
      * of the table.
      */
  -  protected String int2singlealphaCount(int val, char[] table)
  +  protected String int2singlealphaCount(long val, char[] table)
     {
   
       int radix = table.length;
  @@ -1580,7 +1580,7 @@
         return getZeroString();
       }
       else
  -      return (new Character(table[val - 1])).toString();  // index into table is off one, starts at 0
  +      return (new Character(table[(int)val - 1])).toString();  // index into table is off one, starts at 0
     }
   
     /**
  @@ -1597,7 +1597,7 @@
      * Note that the radix of the conversion is inferred from the size
      * of the table.
      */
  -  protected void int2alphaCount(int val, char[] aTable,
  +  protected void int2alphaCount(long val, char[] aTable,
                                   FastStringBuffer stringBuf)
     {
   
  @@ -1654,7 +1654,7 @@
       // it can represent either 10 or zero).  In summary, the correction value of
       // "radix-1" acts like "-1" when run through the mod operator, but with the
       // desireable characteristic that it never produces a negative number.
  -    int correction = 0;
  +    long correction = 0;
   
       // TODO:  throw error on out of range input
       do
  @@ -1668,7 +1668,7 @@
           ? (radix - 1) : 0;
   
         // index in "table" of the next char to emit
  -      lookupIndex = (val + correction) % radix;
  +      lookupIndex = (int)(val + correction) % radix;
   
         // shift input by one "column"
         val = (val / radix);
  @@ -1699,12 +1699,15 @@
      * Note that the radix of the conversion is inferred from the size
      * of the table.
      */
  -  protected String tradAlphaCount(int val, XResourceBundle thisBundle)
  +  protected String tradAlphaCount(long val, XResourceBundle thisBundle)
     {
   
       // if this number is larger than the largest number we can represent, error!
  -    //if (val > ((Integer)thisBundle.getObject("MaxNumericalValue")).intValue())
  -    //return XSLTErrorResources.ERROR_STRING;
  +    if (val > Long.MAX_VALUE)
  +    {
  +      this.error(XSLTErrorResources.ER_NUMBER_TOO_BIG);
  +      return XSLTErrorResources.ERROR_STRING;
  +    }
       char[] table = null;
   
       // index in table of the last character that we stored
  @@ -1738,8 +1741,8 @@
       if (numbering.equals(org.apache.xml.utils.res.XResourceBundle.LANG_MULT_ADD))
       {
         String mult_order = thisBundle.getString(org.apache.xml.utils.res.XResourceBundle.MULT_ORDER);
  -      int[] multiplier =
  -        (int[]) (thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_MULTIPLIER));
  +      long[] multiplier =
  +        (long[]) (thisBundle.getObject(org.apache.xml.utils.res.XResourceBundle.LANG_MULTIPLIER));
         char[] zeroChar = (char[]) thisBundle.getObject("zero");
         int i = 0;
   
  @@ -1773,7 +1776,7 @@
           }
           else if (val >= multiplier[i])
           {
  -          int mult = val / multiplier[i];
  +          long mult = val / multiplier[i];
   
             val = val % multiplier[i];  // save this.
   
  @@ -1803,7 +1806,7 @@
                 table[0] = THEletters[j - 1];  // don't need this                                                                         
   
                 // index in "table" of the next char to emit
  -              lookupIndex = mult / groups[k];
  +              lookupIndex = (int)mult / groups[k];
   
                 //this should not happen
                 if (lookupIndex == 0 && mult == 0)
  @@ -1870,7 +1873,7 @@
           table[0] = theletters[j - 1];  // don't need this
   
           // index in "table" of the next char to emit
  -        lookupIndex = val / groups[count];
  +        lookupIndex = (int)val / groups[count];
   
           // shift input by one "column"
           val = val % groups[count];
  
  
  
  1.3       +1 -1      xml-xalan/java/src/org/apache/xml/utils/res/XResources_cy.java
  
  Index: XResources_cy.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/res/XResources_cy.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XResources_cy.java	2000/12/01 20:30:23	1.2
  +++ XResources_cy.java	2001/11/08 16:34:00	1.3
  @@ -107,7 +107,7 @@
       { "numberGroups", new int[]{ 100, 10, 1 } },
   
       //These only used for mutiplicative-additive numbering
  -    { "multiplier", new int[]{ 1000 } },
  +    { "multiplier", new long[]{ 1000 } },
       { "multiplierChar", new char[]{ 0x03D9 } },
   
       // chinese only??
  
  
  
  1.3       +1 -1      xml-xalan/java/src/org/apache/xml/utils/res/XResources_el.java
  
  Index: XResources_el.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/res/XResources_el.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XResources_el.java	2000/12/01 20:30:24	1.2
  +++ XResources_el.java	2001/11/08 16:34:00	1.3
  @@ -109,7 +109,7 @@
       { "numberGroups", new int[]{ 100, 10, 1 } },
   
       //These only used for mutiplicative-additive numbering
  -    { "multiplier", new int[]{ 1000 } },
  +    { "multiplier", new long[]{ 1000 } },
       { "multiplierChar", new char[]{ 0x03d9 } },
   
       // chinese only??
  
  
  
  1.3       +3 -1      xml-xalan/java/src/org/apache/xml/utils/res/XResources_ja_JP_A.java
  
  Index: XResources_ja_JP_A.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/res/XResources_ja_JP_A.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XResources_ja_JP_A.java	2000/12/01 20:30:26	1.2
  +++ XResources_ja_JP_A.java	2001/11/08 16:34:00	1.3
  @@ -111,8 +111,10 @@
       { "numberGroups", new int[]{ 1 } },
   
       //These only used for mutiplicative-additive numbering
  +    // Note that we are using longs and that the last two 
  +    // multipliers are not supported. This is a known limitation.
       { "multiplier",
  -      new int[]{ 1000000000, 100000000, 10000, 1000, 100, 10 } },
  +      new long[]{ Long.MAX_VALUE, Long.MAX_VALUE, 100000000, 10000, 1000, 100, 10 } },
       { "multiplierChar",
         new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 } },
   
  
  
  
  1.3       +3 -1      xml-xalan/java/src/org/apache/xml/utils/res/XResources_ja_JP_HA.java
  
  Index: XResources_ja_JP_HA.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/res/XResources_ja_JP_HA.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XResources_ja_JP_HA.java	2000/12/01 20:30:27	1.2
  +++ XResources_ja_JP_HA.java	2001/11/08 16:34:00	1.3
  @@ -111,8 +111,10 @@
       { "numberGroups", new int[]{ 1 } },
   
       //These only used for mutiplicative-additive numbering
  +    // Note that we are using longs and that the last two 
  +    // multipliers are not supported. This is a known limitation.
       { "multiplier",
  -      new int[]{ 1000000000, 100000000, 10000, 1000, 100, 10 } },
  +      new long[]{ Long.MAX_VALUE, Long.MAX_VALUE, 100000000, 10000, 1000, 100, 10 } },
       { "multiplierChar",
         new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 } },
   
  
  
  
  1.4       +3 -1      xml-xalan/java/src/org/apache/xml/utils/res/XResources_ja_JP_HI.java
  
  Index: XResources_ja_JP_HI.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/res/XResources_ja_JP_HI.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XResources_ja_JP_HI.java	2000/12/18 00:08:32	1.3
  +++ XResources_ja_JP_HI.java	2001/11/08 16:34:00	1.4
  @@ -112,8 +112,10 @@
       { "numberGroups", new int[]{ 1 } },
   
       //These only used for mutiplicative-additive numbering
  +    // Note that we are using longs and that the last two 
  +    // multipliers are not supported. This is a known limitation.
       { "multiplier",
  -      new int[]{ 1000000000, 100000000, 10000, 1000, 100, 10 } },
  +      new long[]{ Long.MAX_VALUE, Long.MAX_VALUE, 100000000, 10000, 1000, 100, 10 } },
       { "multiplierChar",
         new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 } },
   
  
  
  
  1.4       +3 -1      xml-xalan/java/src/org/apache/xml/utils/res/XResources_ja_JP_I.java
  
  Index: XResources_ja_JP_I.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/res/XResources_ja_JP_I.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XResources_ja_JP_I.java	2000/12/18 00:08:33	1.3
  +++ XResources_ja_JP_I.java	2001/11/08 16:34:00	1.4
  @@ -112,8 +112,10 @@
       { "numberGroups", new int[]{ 1 } },
   
       //These only used for mutiplicative-additive numbering
  +    // Note that we are using longs and that the last two 
  +    // multipliers are not supported. This is a known limitation.
       { "multiplier",
  -      new int[]{ 1000000000, 100000000, 10000, 1000, 100, 10 } },
  +      new long[]{ Long.MAX_VALUE, Long.MAX_VALUE, 100000000, 10000, 1000, 100, 10 } },
       { "multiplierChar",
         new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 } },
   
  
  
  
  1.3       +1 -1      xml-xalan/java/src/org/apache/xml/utils/res/XResources_zh_CN.java
  
  Index: XResources_zh_CN.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/res/XResources_zh_CN.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XResources_zh_CN.java	2000/12/01 20:30:29	1.2
  +++ XResources_zh_CN.java	2001/11/08 16:34:00	1.3
  @@ -111,7 +111,7 @@
       { "zero", new char[]{ 0x96f6 } },
   
       //These only used for mutiplicative-additive numbering
  -    { "multiplier", new int[]{ 100000000, 10000, 1000, 100, 10 } },
  +    { "multiplier", new long[]{ 100000000, 10000, 1000, 100, 10 } },
       { "multiplierChar",
         new char[]{ 0x4ebf, 0x4e07, 0x5343, 0x767e, 0x5341 } },
       { "digits",
  
  
  
  1.3       +1 -1      xml-xalan/java/src/org/apache/xml/utils/res/XResources_zh_TW.java
  
  Index: XResources_zh_TW.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/res/XResources_zh_TW.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XResources_zh_TW.java	2000/12/01 20:30:30	1.2
  +++ XResources_zh_TW.java	2001/11/08 16:34:00	1.3
  @@ -111,7 +111,7 @@
       { "zero", new char[]{ 0x96f6 } },
   
       //These only used for mutiplicative-additive numbering 
  -    { "multiplier", new int[]{ 100000000, 10000, 1000, 100, 10 } },
  +    { "multiplier", new long[]{ 100000000, 10000, 1000, 100, 10 } },
       { "multiplierChar",
         new char[]{ 0x5104, 0x842c, 0x4edf, 0x4f70, 0x62fe } },
       { "digits",
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org