xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From el...@apache.org
Subject cvs commit: xml-xerces/java/src/org/apache/xerces/dom ParentNode.java ChildNode.java TextImpl.java
Date Tue, 10 Feb 2004 17:09:45 GMT
elena       2004/02/10 09:09:45

  Modified:    java/src/org/apache/xerces/dom ParentNode.java
                        ChildNode.java TextImpl.java
  Log:
  Reuse StringBuffer
  
  Revision  Changes    Path
  1.41      +9 -4      xml-xerces/java/src/org/apache/xerces/dom/ParentNode.java
  
  Index: ParentNode.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ParentNode.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- ParentNode.java	26 May 2003 15:03:03 -0000	1.40
  +++ ParentNode.java	10 Feb 2004 17:09:45 -0000	1.41
  @@ -654,9 +654,14 @@
               if (next == null) {
                   return hasTextContent(child) ? ((NodeImpl) child).getTextContent() : "";
               }
  -            StringBuffer buf = new StringBuffer();
  -            getTextContent(buf);
  -            return buf.toString();
  +            if (fBufferStr == null){
  +                fBufferStr = new StringBuffer();
  +            }
  +            else {
  +                fBufferStr.setLength(0);
  +            }
  +            getTextContent(fBufferStr);
  +            return fBufferStr.toString();
           }
           return "";
       }
  
  
  
  1.8       +4 -4      xml-xerces/java/src/org/apache/xerces/dom/ChildNode.java
  
  Index: ChildNode.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ChildNode.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ChildNode.java	9 Aug 2002 15:18:13 -0000	1.7
  +++ ChildNode.java	10 Feb 2004 17:09:45 -0000	1.8
  @@ -75,12 +75,12 @@
       /** Serialization version. */
       static final long serialVersionUID = -6112455738802414002L;
   
  -    // public
  -
  +    transient StringBuffer fBufferStr = null;
  +    
       //
       // Data
       //
  -
  +    
       /** Previous sibling. */
       protected ChildNode previousSibling;
   
  
  
  
  1.22      +10 -5     xml-xerces/java/src/org/apache/xerces/dom/TextImpl.java
  
  Index: TextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/TextImpl.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- TextImpl.java	13 Nov 2003 22:47:15 -0000	1.21
  +++ TextImpl.java	10 Feb 2004 17:09:45 -0000	1.22
  @@ -178,12 +178,17 @@
           if (nextSibling == null) {
               return data;
           }
  -        StringBuffer buffer = new StringBuffer();
  +        if (fBufferStr == null){
  +            fBufferStr = new StringBuffer();
  +        }
  +        else {
  +            fBufferStr.setLength(0);
  +        }
           if (data != null && data.length() != 0) {
  -            buffer.append(data);
  +            fBufferStr.append(data);
           }
  -        getWholeText(nextSibling, buffer);
  -        return buffer.toString();
  +        getWholeText(nextSibling, fBufferStr);
  +        return fBufferStr.toString();
       
       }
   
  
  
  

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


Mime
View raw message