dims 01/08/28 06:23:14
Modified: src/org/apache/cocoon/components/language/markup/sitemap/java
sitemap.xsl
Log:
Patch for "memory leak that affects Matchers and Selectors"
from Christian Schmitt <[EMAIL PROTECTED]>
Revision Changes Path
1.36 +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.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- sitemap.xsl 2001/08/16 07:51:37 1.35
+++ sitemap.xsl 2001/08/28 13:23:14 1.36
@@ -124,7 +124,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Id: sitemap.xsl,v 1.35 2001/08/16 07:51:37 cziegeler Exp $
+ * @version CVS $Id: sitemap.xsl,v 1.36 2001/08/28 13:23:14 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 <code>Configuration</code> instance to this
* <code>Configurable</code> 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]