You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/01/29 18:58:59 UTC

svn commit: r149053 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java /cocoon/branches/BRANCH_2_1_X/status.xml

Author: cziegeler
Date: Sat Jan 29 09:58:57 2005
New Revision: 149053

URL: http://svn.apache.org/viewcvs?view=rev&rev=149053
Log:
   <action dev="CZ" type="fix" fixes-bug="33178" due-to="Jean-Baptiste Quenot" due-to-email="jbq@anyware-tech.com">
     Fixing uri handling when the pass-through feature for mounting sitemaps is used.
   </action>

Modified:
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
   cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java?view=diff&rev=149053&p1=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java&r1=149052&p2=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java&r2=149053
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java	Sat Jan 29 09:58:57 2005
@@ -30,6 +30,8 @@
 import org.apache.cocoon.components.treeprocessor.TreeProcessor;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
 import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.wrapper.EnvironmentWrapper;
+import org.apache.cocoon.environment.wrapper.MutableEnvironmentFacade;
 import org.apache.commons.lang.BooleanUtils;
 
 /**
@@ -99,7 +101,8 @@
         String oldContext   = env.getContext();
         Object oldPassThrough = env.getAttribute(COCOON_PASS_THROUGH);
         env.setAttribute(COCOON_PASS_THROUGH, BooleanUtils.toBooleanObject(passThrough));
-
+        boolean overwriteLastContext = false;
+        
         try {
             env.changeContext(resolvedPrefix, resolvedSource);
 
@@ -110,6 +113,7 @@
                     context.setProcessingPipeline( pp );
                     return true;
                 } else {
+                    overwriteLastContext = true;
                     return false;
                 }
             } else {
@@ -119,6 +123,17 @@
         } finally {
             // Restore context
             env.setContext(oldPrefix, oldURI, oldContext);
+            if ( overwriteLastContext ) {
+                EnvironmentWrapper wrapper = null;
+                if ( env instanceof EnvironmentWrapper ) {
+                    wrapper = (EnvironmentWrapper)env;
+                } else if ( env instanceof MutableEnvironmentFacade ) {
+                    wrapper = ((MutableEnvironmentFacade)env).getDelegate();
+                }
+                if ( wrapper != null ) {
+                    wrapper.changeLastContextToCurrent();
+                }                
+            }
             if (oldPassThrough != null) {
                 env.setAttribute(COCOON_PASS_THROUGH, oldPassThrough);
             } else {

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java?view=diff&rev=149053&p1=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java&r1=149052&p2=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java&r2=149053
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java	Sat Jan 29 09:58:57 2005
@@ -435,6 +435,12 @@
         this.lastURI     = this.uris;
     }
 
+    public void changeLastContextToCurrent() {
+        this.lastContext = this.context;
+        this.lastPrefix  = this.prefix.toString();
+        this.lastURI     = this.uris;
+    }
+
     /**
      * Change the current context to the last one set by changeContext()
      * and return last processor

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&rev=149053&p1=cocoon/branches/BRANCH_2_1_X/status.xml&r1=149052&p2=cocoon/branches/BRANCH_2_1_X/status.xml&r2=149053
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml	Sat Jan 29 09:58:57 2005
@@ -202,6 +202,9 @@
 
   <changes>
   <release version="@version@" date="@date@">
+   <action dev="CZ" type="fix" fixes-bug="33178" due-to="Jean-Baptiste Quenot" due-to-email="jbq@anyware-tech.com">
+     Fixing uri handling when the pass-through feature for mounting sitemaps is used.
+   </action>
    <action dev="CZ" type="add" fixes-bug="33287" due-to="Jens Maukisch" due-to-email="jmaukisch@s-und-n.de">
      Portal Block: Add portal tools framework contribution.
    </action>