cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r588809 - /cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
Date Sat, 27 Oct 2007 00:04:51 GMT
Author: vgritsenko
Date: Fri Oct 26 17:04:46 2007
New Revision: 588809

URL: http://svn.apache.org/viewvc?rev=588809&view=rev
Log:
Fix NPE in finally which was eating original exception.
Fix order of execution: WebAppContextUtils, SitemapEventListeners, enterSitemap when entering
and reverse when leaving.

Modified:
    cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java

Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java?rev=588809&r1=588808&r2=588809&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
(original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
Fri Oct 26 17:04:46 2007
@@ -215,11 +215,11 @@
             handle = WebAppContextUtils.enteringContext(this.webAppContext);
             // invoke listeners
             // only invoke if pipeline is not internally
-            if ( !context.isBuildingPipelineOnly() ) {
+            if (!context.isBuildingPipelineOnly()) {
                 final EnterSitemapEvent enterEvent = new EnterSitemapEvent(this, environment);
-                final Iterator enterSEI = this.enterSitemapEventListeners.iterator();
-                while ( enterSEI.hasNext() ) {
-                    final EnterSitemapEventListener current = (EnterSitemapEventListener)enterSEI.next();
+                final Iterator i = this.enterSitemapEventListeners.iterator();
+                while (i.hasNext()) {
+                    final EnterSitemapEventListener current = (EnterSitemapEventListener)
i.next();
                     current.enteredSitemap(enterEvent);
                 }
             }
@@ -244,17 +244,19 @@
             }
 
         } finally {
-            this.sitemapExecutor.leaveSitemap(this, environment.getObjectModel());
-            WebAppContextUtils.leavingContext(this.webAppContext, handle);
-            // invoke listeners
-            // only invoke if pipeline is not internally
-            if ( !context.isBuildingPipelineOnly() ) {
-                final LeaveSitemapEvent leaveEvent = new LeaveSitemapEvent(this, environment);
-                final Iterator leaveSEI = this.leaveSitemapEventListeners.iterator();
-                while ( leaveSEI.hasNext() ) {
-                    final LeaveSitemapEventListener current = (LeaveSitemapEventListener)leaveSEI.next();
-                    current.leftSitemap(leaveEvent);
+            if (handle != null) {
+                this.sitemapExecutor.leaveSitemap(this, environment.getObjectModel());
+                // invoke listeners
+                // only invoke if pipeline is not internally
+                if (!context.isBuildingPipelineOnly()) {
+                    final LeaveSitemapEvent leaveEvent = new LeaveSitemapEvent(this, environment);
+                    final Iterator i = this.leaveSitemapEventListeners.iterator();
+                    while (i.hasNext()) {
+                        final LeaveSitemapEventListener current = (LeaveSitemapEventListener)
i.next();
+                        current.leftSitemap(leaveEvent);
+                    }
                 }
+                WebAppContextUtils.leavingContext(this.webAppContext, handle);
             }
 
             // Decrement the concurrent request count



Mime
View raw message