You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@apache.org on 2001/01/11 04:10:48 UTC

cvs commit: xml-xalan/java/src/org/apache/xpath/objects XRTreeFrag.java

sboag       01/01/10 19:10:48

  Modified:    java/src/org/apache/xpath/objects XRTreeFrag.java
  Log:
  Call XString.castToNum(s.trim()); instead
  of using the numberFormatter, which allocates
  an object on every request.
  There certainly doesn't seem to me to
  be any reason why rtree frags should format
  differently than any other object.
  
  Revision  Changes    Path
  1.13      +15 -14    xml-xalan/java/src/org/apache/xpath/objects/XRTreeFrag.java
  
  Index: XRTreeFrag.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XRTreeFrag.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- XRTreeFrag.java	2001/01/02 03:47:17	1.12
  +++ XRTreeFrag.java	2001/01/11 03:10:48	1.13
  @@ -109,27 +109,28 @@
     public double num()
     {
   
  -    java.text.NumberFormat m_formatter =
  -      java.text.NumberFormat.getNumberInstance();
  +//    java.text.NumberFormat m_formatter =
  +//      java.text.NumberFormat.getNumberInstance();
       double result;
       String s = DOMHelper.getNodeData((DocumentFragment) m_obj);
   
       if (null != s)
       {
  -      try
  -      {
  +//      try
  +//      {
   
           // result = Double.valueOf(s).doubleValue();
  -        Number n = m_formatter.parse(s.trim());
  -
  -        result = n.doubleValue();
  -      }
  -
  -      // catch(NumberFormatException nfe)
  -      catch (java.text.ParseException nfe)
  -      {
  -        result = Double.NaN;
  -      }
  +//        Number n = m_formatter.parse(s.trim());
  +//
  +//        result = n.doubleValue();
  +          result = XString.castToNum(s.trim());
  +//      }
  +//
  +//      // catch(NumberFormatException nfe)
  +//      catch (java.text.ParseException nfe)
  +//      {
  +//        result = Double.NaN;
  +//      }
       }
       else
       {