cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.1/src/deprecated/java/org/apache/cocoon/components/source SitemapSource.java
Date Wed, 08 Oct 2003 20:18:34 GMT
cziegeler    2003/10/08 13:18:34

  Modified:    src/java/org/apache/cocoon/components EnvironmentStack.java
                        CocoonComponentManager.java
               src/java/org/apache/cocoon Cocoon.java
               src/java/org/apache/cocoon/components/source/impl
                        SitemapSource.java
               src/java/org/apache/cocoon/components/flow
                        AbstractInterpreter.java
               src/deprecated/java/org/apache/cocoon/components/source
                        SitemapSource.java
  Log:
  Cleaned up internal environment handling
  by reducing the dependencies.
  Fixed (hopefully) the detection of the correct
  environment to use when internal pipelines
  are called
  
  Revision  Changes    Path
  1.2       +169 -17   cocoon-2.1/src/java/org/apache/cocoon/components/EnvironmentStack.java
  
  Index: EnvironmentStack.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/EnvironmentStack.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EnvironmentStack.java	9 Mar 2003 00:08:46 -0000	1.1
  +++ EnvironmentStack.java	8 Oct 2003 20:18:34 -0000	1.2
  @@ -50,7 +50,11 @@
   */
   package org.apache.cocoon.components;
   
  +import org.apache.cocoon.xml.XMLConsumer;
   import org.apache.commons.collections.ArrayStack;
  +import org.xml.sax.Attributes;
  +import org.xml.sax.Locator;
  +import org.xml.sax.SAXException;
   
   /**
    * The stack for the processing environment.
  @@ -60,36 +64,184 @@
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @version CVS $Id$
    */
  -public final class EnvironmentStack 
  +final class EnvironmentStack 
       extends ArrayStack 
       implements Cloneable {
       
       int offset;
       
  -    public Object getCurrent() {
  -        return this.peek(this.offset);
  +    Object getCurrent() {
  +        return this.get(offset);
  +        //return this.peek(this.offset);
       }
       
  -    public void incOffset() {
  -        this.offset++;
  -    }
  -    
  -    public void decOffset() {
  -        this.offset--;
  -    }
  -    
  -    public void resetOffset(int value) {
  -        this.offset = value;
  -    }
  -    
  -    public int getOffset() {
  +    int getOffset() {
           return this.offset;
       }
  +  
  +    void setOffset(int value) {
  +        this.offset = value;  
  +    }
       
       public Object clone() {
           EnvironmentStack old = (EnvironmentStack) super.clone();
           old.offset = offset;
           return old;
       }
  +    
  +    XMLConsumer getEnvironmentAwareConsumerWrapper(XMLConsumer consumer, 
  +                                                   int oldOffset) {
  +        return new EnvironmentChanger(consumer, this, oldOffset, this.offset);
  +    }
   }
   
  +/**
  + * This class is an {@link XMLConsumer} that changes the current environment.
  + * When a pipeline calls an internal pipeline, two environments are
  + * established: one for the calling pipeline and one for the internal pipeline.
  + * Now, if SAX events are send from the internal pipeline, they are
  + * received by some component of the calling pipeline, so inbetween we
  + * have to change the environment forth and back.
  + */
  +final class EnvironmentChanger
  +implements XMLConsumer {
  +
  +    final XMLConsumer consumer;
  +    final EnvironmentStack stack;
  +    final int oldOffset;
  +    final int newOffset;
  +    
  +    EnvironmentChanger(XMLConsumer consumer, EnvironmentStack es,
  +                       int oldOffset, int newOffset) {
  +        this.consumer = consumer;
  +        this.stack = es;
  +        this.oldOffset = oldOffset;
  +        this.newOffset = newOffset;
  +    }
  +    
  +    public void setDocumentLocator(Locator locator) {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.setDocumentLocator(locator);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void startDocument()
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.startDocument();
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void endDocument()
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.endDocument();
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void startPrefixMapping(String prefix, String uri)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.startPrefixMapping(prefix, uri);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void endPrefixMapping(String prefix)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.endPrefixMapping(prefix);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void startElement(String uri, String loc, String raw, Attributes a)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.startElement(uri, loc, raw, a);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +
  +    public void endElement(String uri, String loc, String raw)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.endElement(uri, loc, raw);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +    
  +    public void characters(char c[], int start, int len)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.characters(c, start, len);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void ignorableWhitespace(char c[], int start, int len)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.ignorableWhitespace(c, start, len);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void processingInstruction(String target, String data)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.processingInstruction(target, data);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void skippedEntity(String name)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.skippedEntity(name);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void startDTD(String name, String publicId, String systemId)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.startDTD(name, publicId, systemId);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void endDTD()
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.endDTD();
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void startEntity(String name)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.startEntity(name);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void endEntity(String name)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.endEntity(name);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void startCDATA()
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.startCDATA();
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void endCDATA()
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.endCDATA();
  +        this.stack.setOffset(this.newOffset);
  +    }
  +
  +    public void comment(char ch[], int start, int len)
  +    throws SAXException {
  +        this.stack.setOffset(this.oldOffset);
  +        this.consumer.comment(ch, start, len);
  +        this.stack.setOffset(this.newOffset);
  +    }
  +}
  
  
  
  1.17      +33 -16    cocoon-2.1/src/java/org/apache/cocoon/components/CocoonComponentManager.java
  
  Index: CocoonComponentManager.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/CocoonComponentManager.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- CocoonComponentManager.java	4 Aug 2003 03:19:22 -0000	1.16
  +++ CocoonComponentManager.java	8 Oct 2003 20:18:34 -0000	1.17
  @@ -67,9 +67,11 @@
   import org.apache.avalon.framework.component.Recomposable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  +import org.apache.avalon.framework.logger.Logger;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.Processor;
   import org.apache.cocoon.environment.Environment;
  +import org.apache.cocoon.xml.XMLConsumer;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
   import org.apache.excalibur.source.SourceResolver;
  @@ -143,27 +145,31 @@
        * parameters are not set!
        */
       public static void enterEnvironment(Environment      env,
  -                                          ComponentManager manager,
  -                                          Processor        processor) {
  +                                        ComponentManager manager,
  +                                        Processor        processor) {
           if ( null == env || null == manager || null == processor) {                   
                   	
               throw new RuntimeException("CocoonComponentManager.enterEnvironment: all parameters
must be set: " + env + " - " + manager + " - " + processor);
           }
           
  -		if (environmentStack.get() == null) {
  -			environmentStack.set(new EnvironmentStack());
  +        EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
  +		if (stack == null) {
  +            stack = new EnvironmentStack();
  +			environmentStack.set(stack);
   		}
  -		final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
  -		stack.push(new Object[] {env, processor, manager});
  -    
  +		stack.push(new Object[] {env, processor, manager, new Integer(stack.getOffset())});
  +        stack.setOffset(stack.size()-1);
  +        
           env.setAttribute("CocoonComponentManager.processor", processor);
       }
   
       /**
  -     * This hook must be called by the sitemap each time a sitemap is left
  +     * This hook must be called by the sitemap each time a sitemap is left.
  +     * It's the counterpart to {@link #enterEnvironment(Environment, ComponentManager,
Processor)}.
        */
       public static void leaveEnvironment() {
           final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
           final Object[] objs = (Object[])stack.pop();
  +        stack.setOffset(((Integer)objs[3]).intValue());
           if ( stack.isEmpty() ) {
               final Environment env = (Environment)objs[0];
               final Map globalComponents = (Map)env.getAttribute(GlobalRequestLifecycleComponent.class.getName());
  @@ -177,10 +183,28 @@
                   }
               }
               env.removeAttribute(GlobalRequestLifecycleComponent.class.getName());
  +        } 
  +    }
  +    
  +    public static void checkEnvironment(Logger logger) {
  +        // TODO (CZ): This is only for testing - remove it later on
  +        final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
  +        if (stack != null && !stack.isEmpty() ) {
  +            logger.error("ENVIRONMENT STACK HAS NOT BEEN CLEANED PROPERLY");        
           }
       }
   
       /**
  +     * Create an environment aware xml consumer for the cocoon
  +     * protocol
  +     */
  +    public static XMLConsumer createEnvironmentAwareConsumer(XMLConsumer consumer) {
  +        final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
  +        final Object[] objs = (Object[])stack.getCurrent();
  +        return stack.getEnvironmentAwareConsumerWrapper(consumer, ((Integer)objs[3]).intValue());
  +    }
  +    
  +    /**
        * This hook has to be called before a request is processed.
        * The hook is called by the Cocoon component and by the
        * cocoon protocol implementation.
  @@ -233,13 +257,6 @@
               return (Processor) ((Object[])stack.getCurrent())[1];
           }
           return null;
  -    }
  -
  -    /**
  -     * Return the current environment stack (for the cocoon: protocol)
  -     */
  -    public static EnvironmentStack getCurrentEnvironmentStack() {
  -        return (EnvironmentStack)environmentStack.get();
       }
   
       /**
  
  
  
  1.17      +6 -9      cocoon-2.1/src/java/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Cocoon.java	6 Oct 2003 15:59:52 -0000	1.16
  +++ Cocoon.java	8 Oct 2003 20:18:34 -0000	1.17
  @@ -83,7 +83,6 @@
   
   import org.apache.cocoon.components.CocoonComponentManager;
   import org.apache.cocoon.components.ComponentContext;
  -import org.apache.cocoon.components.EnvironmentStack;
   import org.apache.cocoon.components.language.generator.CompiledComponent;
   import org.apache.cocoon.components.language.generator.ProgramGenerator;
   import org.apache.cocoon.components.pipeline.ProcessingPipeline;
  @@ -626,10 +625,10 @@
           }
   
           Object key = CocoonComponentManager.startProcessing(environment);
  +        CocoonComponentManager.enterEnvironment(environment,
  +                                                this.componentManager,
  +                                                this);
           try {
  -            CocoonComponentManager.enterEnvironment(environment,
  -                                                    this.componentManager,
  -                                                    this);
               boolean result;
               if (this.getLogger().isDebugEnabled()) {
                   ++activeRequestCount;
  @@ -661,11 +660,9 @@
               if (this.getLogger().isDebugEnabled()) {
                   --activeRequestCount;
               }
  +            
               // TODO (CZ): This is only for testing - remove it later on
  -            EnvironmentStack stack = CocoonComponentManager.getCurrentEnvironmentStack();
  -            if (stack != null && !stack.isEmpty() ) {
  -                this.getLogger().error("ENVIRONMENT STACK HAS NOT BEEN CLEANED PROPERLY");
       
  -            }
  +            CocoonComponentManager.checkEnvironment(this.getLogger());
           }
       }
   
  
  
  
  1.12      +23 -184   cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
  
  Index: SitemapSource.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SitemapSource.java	8 Oct 2003 10:33:01 -0000	1.11
  +++ SitemapSource.java	8 Oct 2003 20:18:34 -0000	1.12
  @@ -50,6 +50,14 @@
   */
   package org.apache.cocoon.components.source.impl;
   
  +import java.io.ByteArrayInputStream;
  +import java.io.ByteArrayOutputStream;
  +import java.io.IOException;
  +import java.io.InputStream;
  +import java.net.MalformedURLException;
  +import java.util.Iterator;
  +import java.util.Map;
  +
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  @@ -58,13 +66,12 @@
   import org.apache.cocoon.Processor;
   import org.apache.cocoon.ResourceNotFoundException;
   import org.apache.cocoon.components.CocoonComponentManager;
  -import org.apache.cocoon.components.EnvironmentStack;
   import org.apache.cocoon.components.pipeline.ProcessingPipeline;
   import org.apache.cocoon.components.source.SourceUtil;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.environment.ObjectModelHelper;
  -import org.apache.cocoon.environment.wrapper.MutableEnvironmentFacade;
   import org.apache.cocoon.environment.wrapper.EnvironmentWrapper;
  +import org.apache.cocoon.environment.wrapper.MutableEnvironmentFacade;
   import org.apache.cocoon.xml.ContentHandlerWrapper;
   import org.apache.cocoon.xml.XMLConsumer;
   import org.apache.excalibur.source.Source;
  @@ -72,20 +79,10 @@
   import org.apache.excalibur.source.SourceNotFoundException;
   import org.apache.excalibur.source.SourceValidity;
   import org.apache.excalibur.xml.sax.XMLizable;
  -import org.xml.sax.Attributes;
   import org.xml.sax.ContentHandler;
  -import org.xml.sax.Locator;
   import org.xml.sax.SAXException;
   import org.xml.sax.ext.LexicalHandler;
   
  -import java.io.ByteArrayInputStream;
  -import java.io.ByteArrayOutputStream;
  -import java.io.IOException;
  -import java.io.InputStream;
  -import java.net.MalformedURLException;
  -import java.util.Iterator;
  -import java.util.Map;
  -
   /**
    * Implementation of a {@link Source} that gets its content
    * by invoking a pipeline.
  @@ -304,17 +301,14 @@
           try {
               ByteArrayOutputStream os = new ByteArrayOutputStream();
               this.environment.setOutputStream(os);
  -            EnvironmentStack envStack = CocoonComponentManager.getCurrentEnvironmentStack();
  -            int currentOffset = envStack.getOffset();
  +            CocoonComponentManager.enterEnvironment(this.environment,
  +                                                    this.manager,
  +                                                    this.pipelineProcessor);
               try {
  -                CocoonComponentManager.enterEnvironment(this.environment,
  -                                                        this.manager,
  -                                                        this.pipelineProcessor);
  -                envStack.resetOffset(0);
  +                
                   this.processingPipeline.process(this.environment);
               } finally {
                   CocoonComponentManager.leaveEnvironment();
  -                envStack.resetOffset(currentOffset);
               }
               return new ByteArrayInputStream(os.toByteArray());
   
  @@ -392,13 +386,10 @@
               String redirectURL = this.environment.getRedirectURL();
               if (redirectURL == null) {
   
  -                EnvironmentStack envStack = CocoonComponentManager.getCurrentEnvironmentStack();
  -                int currentOffset = envStack.getOffset();
  +                CocoonComponentManager.enterEnvironment(this.environment,
  +                                                        this.manager,
  +                                                        this.pipelineProcessor);
                   try {
  -                    CocoonComponentManager.enterEnvironment(this.environment,
  -                                                            this.manager,
  -                                                            this.pipelineProcessor);
  -                    envStack.resetOffset(0);
                       this.processingPipeline.prepareInternal(this.environment);
                       this.sourceValidity = this.processingPipeline.getValidityForEventPipeline();
                       final String eventPipelineKey = this.processingPipeline.getKeyForEventPipeline();
  @@ -417,7 +408,6 @@
                       }
                   } finally {
                       CocoonComponentManager.leaveEnvironment();
  -                    envStack.resetOffset(currentOffset);
                   }
               } else {
                   if (redirectURL.indexOf(":") == -1) {
  @@ -462,18 +452,15 @@
   	                consumer = new ContentHandlerWrapper(contentHandler);
   	            }
                   // We have to add an environment changer
  -                // clean environment stack handling.
  -                EnvironmentStack envStack = CocoonComponentManager.getCurrentEnvironmentStack();
  -                int currentOffset = envStack.getOffset();
  +                // for clean environment stack handling.
  +                CocoonComponentManager.enterEnvironment(this.environment,
  +                                                        this.manager,
  +                                                        this.pipelineProcessor);
                   try {
  -                    CocoonComponentManager.enterEnvironment(this.environment,
  -                                                            this.manager,
  -                                                            this.pipelineProcessor);
  -                    envStack.resetOffset(0);
  -                    this.processingPipeline.process(this.environment, new EnvironmentChanger(consumer,
envStack));
  +                    this.processingPipeline.process(this.environment,
  +                                       CocoonComponentManager.createEnvironmentAwareConsumer(consumer));

                   } finally {
                       CocoonComponentManager.leaveEnvironment();
  -                    envStack.resetOffset(currentOffset);
                   }
               }
           } catch (SAXException e) {
  @@ -543,151 +530,3 @@
   
   
   }
  -
  -
  -/**
  - * This class is an {@link XMLConsumer} that changes the current environment.
  - * When a pipeline calls an internal pipeline, two environments are
  - * established: one for the calling pipeline and one for the internal pipeline.
  - * Now, if SAX events are send from the internal pipeline, they are
  - * received by some component of the calling pipeline, so inbetween we
  - * have to change the environment forth and back.
  - */
  -final class EnvironmentChanger
  -implements XMLConsumer {
  -
  -    final XMLConsumer consumer;
  -    final EnvironmentStack stack;
  -    
  -    EnvironmentChanger(XMLConsumer consumer, EnvironmentStack es) {
  -        this.consumer = consumer;
  -        this.stack = es;
  -    }
  -    
  -    public void setDocumentLocator(Locator locator) {
  -        this.stack.incOffset();
  -        this.consumer.setDocumentLocator(locator);
  -        this.stack.decOffset();
  -    }
  -
  -    public void startDocument()
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.startDocument();
  -        this.stack.decOffset();
  -    }
  -
  -    public void endDocument()
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.endDocument();
  -        this.stack.decOffset();
  -    }
  -
  -    public void startPrefixMapping(String prefix, String uri)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.startPrefixMapping(prefix, uri);
  -        this.stack.decOffset();
  -    }
  -
  -    public void endPrefixMapping(String prefix)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.endPrefixMapping(prefix);
  -        this.stack.decOffset();
  -    }
  -
  -    public void startElement(String uri, String loc, String raw, Attributes a)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.startElement(uri, loc, raw, a);
  -        this.stack.decOffset();
  -    }
  -
  -
  -    public void endElement(String uri, String loc, String raw)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.endElement(uri, loc, raw);
  -        this.stack.decOffset();
  -    }
  -    
  -    public void characters(char c[], int start, int len)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.characters(c, start, len);
  -        this.stack.decOffset();
  -    }
  -
  -    public void ignorableWhitespace(char c[], int start, int len)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.ignorableWhitespace(c, start, len);
  -        this.stack.decOffset();
  -    }
  -
  -    public void processingInstruction(String target, String data)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.processingInstruction(target, data);
  -        this.stack.decOffset();
  -    }
  -
  -    public void skippedEntity(String name)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.skippedEntity(name);
  -        this.stack.decOffset();
  -    }
  -
  -    public void startDTD(String name, String publicId, String systemId)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.startDTD(name, publicId, systemId);
  -        this.stack.decOffset();
  -    }
  -
  -    public void endDTD()
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.endDTD();
  -        this.stack.decOffset();
  -    }
  -
  -    public void startEntity(String name)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.startEntity(name);
  -        this.stack.decOffset();
  -    }
  -
  -    public void endEntity(String name)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.endEntity(name);
  -        this.stack.decOffset();
  -    }
  -
  -    public void startCDATA()
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.startCDATA();
  -        this.stack.decOffset();
  -    }
  -
  -    public void endCDATA()
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.endCDATA();
  -        this.stack.decOffset();
  -    }
  -
  -    public void comment(char ch[], int start, int len)
  -    throws SAXException {
  -        this.stack.incOffset();
  -        this.consumer.comment(ch, start, len);
  -        this.stack.decOffset();
  -    }
  -}
  -
  
  
  
  1.9       +8 -4      cocoon-2.1/src/java/org/apache/cocoon/components/flow/AbstractInterpreter.java
  
  Index: AbstractInterpreter.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/AbstractInterpreter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractInterpreter.java	2 Sep 2003 16:29:09 -0000	1.8
  +++ AbstractInterpreter.java	8 Oct 2003 20:18:34 -0000	1.9
  @@ -202,10 +202,10 @@
           try {
               // Retrieve a processor instance
               processor = (Processor)this.manager.lookup(Processor.ROLE);
  -
  +            
               // Enter the environment
               CocoonComponentManager.enterEnvironment(wrapper, this.manager, processor);
  -
  +            
               // Process the subrequest
               result = processor.process(wrapper);
               wrapper.commitResponse();
  @@ -217,7 +217,11 @@
               throw(any);
           } finally {
               // Leave the environment, terminate processing and release processor
  -            CocoonComponentManager.leaveEnvironment();
  +            if ( processor != null ) {
  +                // enterEnvironemnt has only been called if the
  +                // processor has been looked up
  +                CocoonComponentManager.leaveEnvironment();
  +            }
               CocoonComponentManager.endProcessing(wrapper, key);
               this.manager.release(processor);
           }
  
  
  
  1.5       +7 -7      cocoon-2.1/src/deprecated/java/org/apache/cocoon/components/source/SitemapSource.java
  
  Index: SitemapSource.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/deprecated/java/org/apache/cocoon/components/source/SitemapSource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SitemapSource.java	6 Jul 2003 11:48:48 -0000	1.4
  +++ SitemapSource.java	8 Oct 2003 20:18:34 -0000	1.5
  @@ -240,10 +240,10 @@
           try {
               ByteArrayOutputStream os = new ByteArrayOutputStream();
               this.environment.setOutputStream(os);
  +            CocoonComponentManager.enterEnvironment(this.environment,
  +                                                    this.manager,
  +                                                    this.pipelineProcessor);
               try {
  -                CocoonComponentManager.enterEnvironment(this.environment,
  -                                                        this.manager,
  -                                                        this.pipelineProcessor);
                   this.processingPipeline.process(this.environment);
               } finally {
                   CocoonComponentManager.leaveEnvironment();
  @@ -337,10 +337,10 @@
                   // clean environment stack handling.
                   XMLSerializer xmls = (XMLSerializer) this.manager.lookup(XMLSerializer.ROLE);
                   Object fragment;
  +                CocoonComponentManager.enterEnvironment(this.environment,
  +                                                        this.manager,
  +                                                        this.pipelineProcessor);
                   try {
  -                    CocoonComponentManager.enterEnvironment(this.environment,
  -                                                            this.manager,
  -                                                            this.pipelineProcessor);
                       this.processingPipeline.process(this.environment, xmls);
                       fragment = xmls.getSAXFragment();
                   } finally {
  
  
  

Mime
View raw message