Hi Carsten,

Lengthy rational below; maybe just skip to the attachments.

Related to old bug 10281.  It's popped up again just as your commit comments 
said it would.  Thanks (and to Ugo) for fixing the ForwardRedirector problems too.
This is completely unrelated to the ForwardRedirector Problem/Fix.

When i posted a patch, i modified AbstractProcessingPipeline making it "smarter?".

"This patch gives the pipeline knowledge of which processor it belongs to when
the generator is set,  then reminds it which processor to use when the pipeline
is setup.  This corrects the problem.  I've only tested with the treeprocessor,
but i assume that if the compiled sitemap had the bug, this fix will pertain to
it as well."

You realized that this shouldn't be in the processing pipeline so you put it
in the environment wrapper.  My suspicion is that i was violating IoC by making
the pipeline aware of the processor it is contained in.

Anyway, all was good until the one method that happened to be called on the 
environment when entering a sitemap was removed in cleanup.  No matter where
you stick that thing in the environment wrapper, it's not going to work.  
EnvironmentWrapper.ChangeContext is called in mount node before the environment is 
entered in the ComponentManager (happens in TreeProcessor) and by the time 
changeToLastContext is called, the inner environment has already been left.

So...

Why not put a processor attribute in the environment from within 
TreeProcessor.processInternal()?

See attachments.  I didn't do anything with EnvironmentWrapper, but this should allow
you to remove all of the hacks.

Tim
Index: TreeProcessor.java
===================================================================
RCS file: 
/home/cvspublic/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v
retrieving revision 1.1
diff -u -r1.1 TreeProcessor.java
--- TreeProcessor.java  9 Mar 2003 00:09:18 -0000       1.1
+++ TreeProcessor.java  12 Mar 2003 04:01:54 -0000
@@ -332,6 +332,7 @@
         context.enableLogging(getLogger());
 
         CocoonComponentManager.enterEnvironment(environment, this.manager, this);
+        environment.setAttribute("processor", this);
         try {
             if ( process(environment, context) ) {
                 return context.getProcessingPipeline();
Index: SitemapSource.java
===================================================================
RCS file: 
/home/cvspublic/cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java,v
retrieving revision 1.1
diff -u -r1.1 SitemapSource.java
--- SitemapSource.java  9 Mar 2003 00:09:14 -0000       1.1
+++ SitemapSource.java  12 Mar 2003 03:59:48 -0000
@@ -343,7 +343,8 @@
             this.processKey = 
CocoonComponentManager.startProcessing(this.environment);
             this.environment.setURI(this.prefix, this.uri);
             this.processingPipeline = 
this.processor.processInternal(this.environment);
-            this.pipelineProcessor = this.environment.changeToLastContext();
+            this.environment.changeToLastContext();
+            this.pipelineProcessor = 
(Processor)this.environment.getAttribute("processor");
 
             String redirectURL = this.environment.getRedirectURL();
             if (redirectURL == null) {

Reply via email to