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...@locus.apache.org on 2000/03/13 22:56:03 UTC

cvs commit: xml-xalan/src/org/apache/xalan/xslt/res XSLTErrorResources.java

mmidy       00/03/13 13:56:02

  Modified:    src/org/apache/xalan/xslt ElemDecimalFormat.java
                        ElemNumber.java
               src/org/apache/xalan/xslt/res XSLTErrorResources.java
  Log:
  Throw an error if a single character is not passed as value for decimal separator, grouping separator, zero digit etc...
  
  Revision  Changes    Path
  1.9       +40 -8     xml-xalan/src/org/apache/xalan/xslt/ElemDecimalFormat.java
  
  Index: ElemDecimalFormat.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/ElemDecimalFormat.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ElemDecimalFormat.java	2000/03/02 22:17:27	1.8
  +++ ElemDecimalFormat.java	2000/03/13 21:55:59	1.9
  @@ -113,11 +113,19 @@
         }
         else if(aname.equals(Constants.ATTRNAME_DECIMALSEPARATOR))
         {
  -        m_decimalSeparator_avt = atts.getValue(i);
  +        String decimalSepValue = atts.getValue(i);
  +        if (decimalSepValue.length() == 1)
  +        m_decimalSeparator_avt = decimalSepValue;
  +        else
  +          processor.warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {aname, decimalSepValue});      
         }
   	    else if(aname.equals(Constants.ATTRNAME_GROUPINGSEPARATOR))
         {
  -        m_groupingSeparator_avt = atts.getValue(i);
  +        String sepValue = atts.getValue(i);
  +        if (sepValue.length() == 1)
  +          m_groupingSeparator_avt = sepValue;
  +        else
  +          processor.warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {aname, sepValue});      
         }
         else if(aname.equals(Constants.ATTRNAME_INFINITY))
         {
  @@ -125,7 +133,11 @@
         }
         else if(aname.equals(Constants.ATTRNAME_MINUSSIGN))
         {
  -        m_minusSign_avt = atts.getValue(i);
  +        String minusValue = atts.getValue(i);
  +        if (minusValue.length() == 1)
  +          m_minusSign_avt = minusValue;
  +        else
  +          processor.warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {aname, minusValue});      
         }
         else if(aname.equals(Constants.ATTRNAME_NAN))
         {
  @@ -133,23 +145,43 @@
         }
         else if(aname.equals(Constants.ATTRNAME_PERCENT))
         {
  -        m_percent_avt = atts.getValue(i);
  +        String percentValue = atts.getValue(i);
  +        if (percentValue.length() == 1)
  +          m_percent_avt = percentValue;
  +        else
  +          processor.warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {aname, percentValue});      
         }
         else if(aname.equals(Constants.ATTRNAME_PERMILLE))
         {
  -        m_permille_avt = atts.getValue(i);
  +        String permilleValue = atts.getValue(i);
  +        if (permilleValue.length() == 1)
  +          m_permille_avt = permilleValue;
  +        else
  +          processor.warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {aname, permilleValue});      
         }
         else if(aname.equals(Constants.ATTRNAME_ZERODIGIT))
         {
  -        m_zeroDigit_avt = atts.getValue(i);
  +        String zeroDigitValue = atts.getValue(i);
  +        if (zeroDigitValue.length() == 1)
  +          m_zeroDigit_avt = zeroDigitValue;
  +        else
  +          processor.warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {aname, zeroDigitValue});      
         }
         else if(aname.equals(Constants.ATTRNAME_DIGIT))
         {
  -        m_digit_avt = atts.getValue(i);
  +        String digitValue = atts.getValue(i);
  +        if (digitValue.length() == 1)
  +          m_digit_avt = digitValue;
  +        else
  +          processor.warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {aname, digitValue});      
         }
   	    else if(aname.equals(Constants.ATTRNAME_PATTERNSEPARATOR))
         {
  -        m_patternSeparator_avt = atts.getValue(i);
  +        String patternSepValue = atts.getValue(i);
  +        if (patternSepValue.length() == 1)
  +          m_patternSeparator_avt = patternSepValue;
  +        else
  +          processor.warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {aname, patternSepValue});      
         }
         else if(!isAttrOK(aname, atts, i))
         {
  
  
  
  1.12      +7 -1      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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ElemNumber.java	2000/03/02 10:23:02	1.11
  +++ ElemNumber.java	2000/03/13 21:56:00	1.12
  @@ -215,8 +215,14 @@
         }
         else if(aname.equals(Constants.ATTRNAME_GROUPINGSEPARATOR))
         {
  -        m_groupingSeparator_avt = new AVT(aname, atts.getType(i), atts.getValue(i),
  +        String sepValue = atts.getValue(i);
  +        if (sepValue.length()== 1)
  +        {    
  +          m_groupingSeparator_avt = new AVT(aname, atts.getType(i), sepValue,
                                             this, m_stylesheet, processor);
  +        }
  +        else
  +          processor.warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {aname, sepValue});
         }
         else if(aname.equals(Constants.ATTRNAME_GROUPINGSIZE))
         {
  
  
  
  1.20      +6 -1      xml-xalan/src/org/apache/xalan/xslt/res/XSLTErrorResources.java
  
  Index: XSLTErrorResources.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/res/XSLTErrorResources.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- XSLTErrorResources.java	2000/03/06 20:13:51	1.19
  +++ XSLTErrorResources.java	2000/03/13 21:56:01	1.20
  @@ -77,7 +77,7 @@
   public static final String WARNING_SUFFIX = "WR";
   
   public static final int MAX_CODE = 95;                  // this is needed to keep track of the number of messages          
  -public static final int MAX_WARNING = 24;             // this is needed to keep track of the number of warnings
  +public static final int MAX_WARNING = 25;             // this is needed to keep track of the number of warnings
   public static final int MAX_OTHERS = 41;
   public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING +1;
   
  @@ -712,6 +712,11 @@
   public static final int WG_ILLEGAL_ATTRIBUTE_NAME = 24;
   static {contents[WG_ILLEGAL_ATTRIBUTE_NAME + MAX_CODE][1] 
             = "Illegal attribute name: {0}";
  +}
  +
  +public static final int WG_ILLEGAL_ATTRIBUTE_VALUE = 25;
  +static {contents[WG_ILLEGAL_ATTRIBUTE_VALUE + MAX_CODE][1] 
  +          = "Illegal value used for attribute {0}: {1}";
   }