dims        01/08/28 06:23:35

  Modified:    src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: cocoon_20_branch sitemap.xsl
  Log:
  Patch for "memory leak that affects Matchers and Selectors"
  from Christian Schmitt <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.11.2.28 +27 -4     
xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
  retrieving revision 1.11.2.27
  retrieving revision 1.11.2.28
  diff -u -r1.11.2.27 -r1.11.2.28
  --- sitemap.xsl       2001/08/16 07:49:35     1.11.2.27
  +++ sitemap.xsl       2001/08/28 13:23:35     1.11.2.28
  @@ -124,7 +124,7 @@
        *
        * @author &lt;a href="mailto:[EMAIL PROTECTED]"&gt;Giacomo Pati&lt;/a&gt;
        * @author &lt;a href="mailto:[EMAIL PROTECTED]"&gt;Berin Loritsch&lt;/a&gt;
  -     * @version CVS $Id: sitemap.xsl,v 1.11.2.27 2001/08/16 07:49:35 cziegeler Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.11.2.28 2001/08/28 13:23:35 dims Exp $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static final String LOCATION = "<xsl:value-of select="translate(@file-path, 
'/', '.')"/>.<xsl:value-of select="@file-name"/>";
  @@ -197,6 +197,29 @@
         </xsl:for-each>
   
         /**
  +       * Method that handles non-factory selectors.
  +       */
  +      private boolean isSelected(String hint, String testValue, List listOfMaps, 
Parameters params, Map objectModel) throws Exception {
  +        boolean retVal;
  +        Selector selector = (Selector)this.selectors.select(hint);
  +        retVal = selector.select(substitute(listOfMaps, testValue), objectModel, 
params);
  +        this.selectors.release(selector);
  +         return retVal;
  +      }
  +
  +      /**
  +       * Method that handles non-factory matchers.
  +       */
  +      private Map matches(String hint, String patternValue, List listOfMaps, 
Parameters params, Map objectModel) throws Exception {
  +        Map map;
  +        Matcher matcher = (Matcher)this.matchers.select(hint);
  +        map = matcher.match(substitute(listOfMaps, patternValue), objectModel, 
params);
  +        this.matchers.release(matcher);
  +        return map;
  +      }
  +
  +
  +      /**
          * Pass a &lt;code&gt;Configuration&lt;/code&gt; instance to this
          * &lt;code&gt;Configurable&lt;/code&gt; class.
          */
  @@ -646,12 +669,11 @@
             <xsl:value-of select="translate($matcher-type, '- ', 
'__')"/>Match(<xsl:value-of select="$matcher-name2"/>_expr, objectModel, <xsl:value-of 
select="$component-param"/>)
           </xsl:when>
           <xsl:otherwise>
  -          <xsl:text>((Matcher)this.matchers.select("</xsl:text><xsl:value-of 
select="$matcher-type"/>")).match(substitute(listOfMaps,"<xsl:value-of 
select="$pattern-value"/>"), objectModel, <xsl:value-of 
select="$component-param"/><xsl:text>)</xsl:text>
  +          matches("<xsl:value-of select="$matcher-type"/>", "<xsl:value-of 
select="$pattern-value"/>", listOfMaps, <xsl:value-of select="$component-param"/>, 
objectModel)
           </xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
   
  -
       <!-- this is the actual code produced -->
       // handling "<xsl:value-of select="@pattern"/>"
           if ((map = <xsl:value-of select="$matcher-name"/>) != null) {
  @@ -842,10 +864,11 @@
               <xsl:value-of select="translate($selector-type, '- ', 
'__')"/>Select(<xsl:value-of select="$selector-name2"/>_expr, objectModel, 
<xsl:value-of select="$component-param"/>)
             </xsl:when>
             <xsl:otherwise>
  -            <xsl:text>((Selector)this.selectors.select("</xsl:text><xsl:value-of 
select="$selector-type"/>")).select(substitute(listOfMaps,"<xsl:value-of 
select="$test-value"/>"), objectModel, <xsl:value-of 
select="$component-param"/><xsl:text>)</xsl:text>
  +            isSelected("<xsl:value-of select="$selector-type"/>", "<xsl:value-of 
select="$test-value"/>", listOfMaps, <xsl:value-of select="$component-param"/>, 
objectModel)
             </xsl:otherwise>
           </xsl:choose>
         </xsl:variable>
  +
   
         <!-- this is the actual code produced on the when elements -->
         <xsl:if test="position() > 1">
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to