Index: sitemap.xsl
===================================================================
RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
retrieving revision 1.11.2.8
diff -u -r1.11.2.8 sitemap.xsl
--- sitemap.xsl	2001/06/12 16:21:33	1.11.2.8
+++ sitemap.xsl	2001/06/18 13:00:06
@@ -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;
           }

