dims        01/06/19 04:56:47

  Modified:    src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: cocoon_20_branch sitemap.xsl
  Log:
  Patch from Vadim for preventing OutOfMemory errors.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.11.2.9  +17 -10    
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.8
  retrieving revision 1.11.2.9
  diff -u -r1.11.2.8 -r1.11.2.9
  --- sitemap.xsl       2001/06/12 16:21:33     1.11.2.8
  +++ sitemap.xsl       2001/06/19 11:56:46     1.11.2.9
  @@ -127,7 +127,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.8 2001/06/12 16:21:33 bloritsch Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.11.2.9 2001/06/19 11:56:46 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"/>";
  @@ -406,19 +406,23 @@
         public boolean process(Environment environment) throws Exception {
           /* the &lt;code&gt;EventPipeline&lt;/code&gt; is used to collect the xml 
producing sitemap
              components and the &lt;code&gt;StreamPipeline&lt;/code&gt; to produce 
the requested resource */
  -        EventPipeline eventPipeline = 
(EventPipeline)this.manager.lookup(Roles.EVENT_PIPELINE);
  -        StreamPipeline pipeline = 
(StreamPipeline)this.manager.lookup(Roles.STREAM_PIPELINE);
  -        eventPipeline.setSitemap(this);
  -        pipeline.setEventPipeline(eventPipeline);
  +        EventPipeline eventPipeline = null;
  +        StreamPipeline pipeline = null;
           boolean result = false;
           try {
  -           result = process (environment, pipeline, eventPipeline, false);
  +          eventPipeline = (EventPipeline)this.manager.lookup(Roles.EVENT_PIPELINE);
  +          pipeline = (StreamPipeline)this.manager.lookup(Roles.STREAM_PIPELINE);
  +          eventPipeline.setSitemap(this);
  +          pipeline.setEventPipeline(eventPipeline);
  +          result = process (environment, pipeline, eventPipeline, false);
           } catch (Exception e) {
             getLogger().error("processing of resource failed", e);
             throw e;
           } finally {
  -          manager.release(eventPipeline);
  -          manager.release(pipeline);
  +          if(eventPipeline != null)
  +            manager.release(eventPipeline);
  +          if(pipeline != null)
  +            manager.release(pipeline);
           }
           return result;
         }
  @@ -507,8 +511,8 @@
           <xsl:if test="(./map:handle-errors)">
             private boolean error_process_<xsl:value-of select="$pipeline-position"/> 
(Environment environment, Map objectModel, Exception e, boolean internalRequest)
             throws Exception {
  -            StreamPipeline pipeline = null;
               EventPipeline eventPipeline = null;
  +            StreamPipeline pipeline = null;
               try {
                 eventPipeline = 
(EventPipeline)this.manager.lookup(Roles.EVENT_PIPELINE);
                 pipeline = (StreamPipeline)this.manager.lookup(Roles.STREAM_PIPELINE);
  @@ -523,7 +527,10 @@
                 getLogger().error("error notifier barfs", ex);
                 throw e;
               } finally {
  -              this.manager.release(pipeline);
  +              if(eventPipeline != null)
  +                this.manager.release(eventPipeline);
  +              if(pipeline != null)
  +                this.manager.release(pipeline);
               }
               return false;
             }
  
  
  

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