sylvain     01/08/30 01:48:55

  Modified:    src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: cocoon_20_branch sitemap.xsl
  Log:
  Ensure matchers and selectors are released even when an exception occurs.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.11.2.29 +11 -9     
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.28
  retrieving revision 1.11.2.29
  diff -u -r1.11.2.28 -r1.11.2.29
  --- sitemap.xsl       2001/08/28 13:23:35     1.11.2.28
  +++ sitemap.xsl       2001/08/30 08:48:55     1.11.2.29
  @@ -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.11.2.28 2001/08/28 13:23:35 dims Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.11.2.29 2001/08/30 08:48:55 sylvain 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"/>";
  @@ -200,22 +200,24 @@
          * 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;
  +        try {
  +          return selector.select(substitute(listOfMaps, testValue), objectModel, 
params);
  +        } finally {
  +          this.selectors.release(selector);
  +        }
         }
   
         /**
          * 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;
  +        try {
  +          return matcher.match(substitute(listOfMaps, patternValue), objectModel, 
params);
  +        } finally {
  +          this.matchers.release(matcher);
  +        }
         }
   
   
  
  
  

----------------------------------------------------------------------
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