You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by ra...@apache.org on 2005/05/15 13:48:54 UTC

cvs commit: xml-security/src/org/apache/xml/security/c14n/implementations Canonicalizer20010315.java Canonicalizer20010315Excl.java

raul        2005/05/15 04:48:54

  Modified:    src/org/apache/xml/security/c14n/implementations
                        Canonicalizer20010315.java
                        Canonicalizer20010315Excl.java
  Log:
  Reduce Object creation during c14n, from one to level to one per c14n.
  
  Revision  Changes    Path
  1.36      +7 -4      xml-security/src/org/apache/xml/security/c14n/implementations/Canonicalizer20010315.java
  
  Index: Canonicalizer20010315.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/c14n/implementations/Canonicalizer20010315.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- Canonicalizer20010315.java	18 Nov 2004 22:47:47 -0000	1.35
  +++ Canonicalizer20010315.java	15 May 2005 11:48:54 -0000	1.36
  @@ -44,6 +44,7 @@
    */
   public abstract class Canonicalizer20010315 extends CanonicalizerBase {
   	boolean firstCall=true;
  +	final SortedSet result= new TreeSet(COMPARE);
       static final String XMLNS_URI=Constants.NamespaceSpecNS;
       static final String XML_LANG_URI=Constants.XML_LANG_SPACE_SpecNS;
      /**
  @@ -74,8 +75,9 @@
      	  if (!E.hasAttributes() && !firstCall) {
            return null; 
         }
  -      // result will contain the attrs which have to be outputted
  -      SortedSet result = new TreeSet(COMPARE);      
  +      // result will contain the attrs which have to be outputted   	  
  +      final SortedSet result = this.result;       
  +      result.clear();
         NamedNodeMap attrs = E.getAttributes();
         int attrsLength = attrs.getLength();      
               
  @@ -196,7 +198,8 @@
       }
       
       
  -    SortedSet result = new TreeSet(COMPARE);
  +    SortedSet result = this.result;       
  +    result.clear();
       
               
       for (int i = 0; i < attrsLength; i++) {
  
  
  
  1.19      +6 -3      xml-security/src/org/apache/xml/security/c14n/implementations/Canonicalizer20010315Excl.java
  
  Index: Canonicalizer20010315Excl.java
  ===================================================================
  RCS file: /home/cvs/xml-security/src/org/apache/xml/security/c14n/implementations/Canonicalizer20010315Excl.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Canonicalizer20010315Excl.java	18 Nov 2004 22:50:26 -0000	1.18
  +++ Canonicalizer20010315Excl.java	15 May 2005 11:48:54 -0000	1.19
  @@ -53,6 +53,7 @@
         */
       TreeSet _inclusiveNSSet = null;
       static final String XMLNS_URI=Constants.NamespaceSpecNS;
  +    final SortedSet result = new TreeSet(COMPARE);
   	/**
   	 * Constructor Canonicalizer20010315Excl
   	 * 
  @@ -112,7 +113,8 @@
   		// System.out.println("During the traversal, I encountered " +
   		// XMLUtils.getXPath(E));
   		// result will contain the attrs which have to be outputted
  -		SortedSet result = new TreeSet(COMPARE);
  +		SortedSet result = this.result;       
  +	    result.clear();
   		NamedNodeMap attrs=null;
           
   		int attrsLength = 0;
  @@ -209,7 +211,8 @@
   	final Iterator handleAttributes(Element E, NameSpaceSymbTable ns)
   			throws CanonicalizationException {
   		// result will contain the attrs which have to be outputted
  -		SortedSet result = new TreeSet(COMPARE);
  +		SortedSet result = this.result;       
  +	    result.clear();
   		NamedNodeMap attrs = null;
   		int attrsLength = 0;
           if (E.hasAttributes()) {