xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mor...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java
Date Thu, 29 Nov 2001 12:51:32 GMT
morten      01/11/29 04:51:31

  Modified:    java/src/org/apache/xalan/xsltc/compiler
                        DecimalFormatting.java
               java/src/org/apache/xalan/xsltc/runtime BasisLibrary.java
  Log:
  A fix for a few regressions from yesterday.
  PR:		n/a
  Obtained from:	n/a
  Submitted by:	morten@xml.apache.org
  Reviewed by:	morten@xml.apache.org
  
  Revision  Changes    Path
  1.7       +34 -2     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DecimalFormatting.java	2001/10/30 08:42:55	1.6
  +++ DecimalFormatting.java	2001/11/29 12:51:31	1.7
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: DecimalFormatting.java,v 1.6 2001/10/30 08:42:55 morten Exp $
  + * @(#)$Id: DecimalFormatting.java,v 1.7 2001/11/29 12:51:31 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -129,7 +129,26 @@
   	il.append(new NEW(cpg.addClass(DFS_CLASS)));
   	il.append(DUP);
   	il.append(new INVOKESPECIAL(init));
  -	
  +
  +	String tmp = getAttribute("NaN");
  +	if ((tmp == null) || (tmp.equals(EMPTYSTRING))) {
  +	    int nan = cpg.addMethodref(DFS_CLASS,
  +				       "setNaN", "(Ljava/lang/String;)V");
  +	    il.append(DUP);
  +	    il.append(new PUSH(cpg, "NaN"));
  +	    il.append(new INVOKEVIRTUAL(nan));
  +	}
  +
  +	tmp = getAttribute("infinity");
  +	if ((tmp == null) || (tmp.equals(EMPTYSTRING))) {
  +	    int inf = cpg.addMethodref(DFS_CLASS,
  +				       "setInfinity",
  +				       "(Ljava/lang/String;)V");
  +	    il.append(DUP);
  +	    il.append(new PUSH(cpg, "Infinity"));
  +	    il.append(new INVOKEVIRTUAL(inf));
  +	}
  +	    
   	final int nAttributes = _attributes.getLength();
   	for (int i = 0; i < nAttributes; i++) {
   	    final String name = _attributes.getQName(i);
  @@ -229,6 +248,19 @@
   	il.append(new NEW(cpg.addClass(DFS_CLASS)));
   	il.append(DUP);
   	il.append(new INVOKESPECIAL(init));
  +
  +	int nan = cpg.addMethodref(DFS_CLASS,
  +				   "setNaN", "(Ljava/lang/String;)V");
  +	il.append(DUP);
  +	il.append(new PUSH(cpg, "NaN"));
  +	il.append(new INVOKEVIRTUAL(nan));
  +
  +	int inf = cpg.addMethodref(DFS_CLASS,
  +				   "setInfinity",
  +				   "(Ljava/lang/String;)V");
  +	il.append(DUP);
  +	il.append(new PUSH(cpg, "Infinity"));
  +	il.append(new INVOKEVIRTUAL(inf));
   
   	final int put = cpg.addMethodref(TRANSLET_CLASS,
   					 "addDecimalFormat",
  
  
  
  1.31      +2 -9      xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java
  
  Index: BasisLibrary.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- BasisLibrary.java	2001/11/27 14:38:07	1.30
  +++ BasisLibrary.java	2001/11/29 12:51:31	1.31
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: BasisLibrary.java,v 1.30 2001/11/27 14:38:07 morten Exp $
  + * @(#)$Id: BasisLibrary.java,v 1.31 2001/11/29 12:51:31 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -806,7 +806,6 @@
        */
       public static double stringToReal(String s) {
   	try {
  -	    if (s.length() == 0) return(0.0);
   	    return Double.valueOf(s).doubleValue();
   	}
   	catch (NumberFormatException e) {
  @@ -856,15 +855,9 @@
       public static String formatNumber(double number, String pattern,
   				      DecimalFormat formatter) {
   	try {
  -	    if (Double.isNaN(number))
  -		return(formatter.getDecimalFormatSymbols().getNaN());
  -	    else if (number == Double.NEGATIVE_INFINITY) 
  -		return(formatter.getDecimalFormatSymbols().getInfinity());
  -	    else if (number == Double.POSITIVE_INFINITY)
  -		return(formatter.getDecimalFormatSymbols().getInfinity());
   	    StringBuffer result = new StringBuffer();
   	    formatter.applyLocalizedPattern(pattern);
  -	    formatter.format(number,result,_fieldPosition);
  +	    formatter.format(number, result, _fieldPosition);
   	    return(result.toString());
   	}
   	catch (IllegalArgumentException e) {
  
  
  

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


Mime
View raw message