cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/transformation CIncludeTransformer.java TraxTransformer.java XTTransformer.java
Date Wed, 22 Aug 2001 03:51:06 GMT
vgritsenko    01/08/21 20:51:06

  Modified:    src/org/apache/cocoon Cocoon.java Main.java
                        ProcessingException.java
               src/org/apache/cocoon/acting
                        AbstractComplementaryConfigurableAction.java
                        ResourceExistsAction.java
               src/org/apache/cocoon/components/language/generator
                        ProgramGeneratorImpl.java
               src/org/apache/cocoon/components/language/markup
                        AbstractMarkupLanguage.java
               src/org/apache/cocoon/components/language/markup/xsp
                        XSPFormValidatorHelper.java
               src/org/apache/cocoon/components/source SitemapSource.java
                        URLSource.java
               src/org/apache/cocoon/environment Source.java
               src/org/apache/cocoon/generation DirectoryGenerator.java
                        FileGenerator.java HTMLGenerator.java
                        JspGenerator.java PhpGenerator.java
                        ScriptGenerator.java ServerPagesGenerator.java
               src/org/apache/cocoon/reading ResourceReader.java
               src/org/apache/cocoon/sitemap ContentAggregator.java
                        Handler.java
               src/org/apache/cocoon/transformation
                        CIncludeTransformer.java TraxTransformer.java
                        XTTransformer.java
  Log:
  recycling Sources
  
  Revision  Changes    Path
  1.20      +3 -1      xml-cocoon2/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Cocoon.java	2001/08/20 20:23:52	1.19
  +++ Cocoon.java	2001/08/22 03:51:05	1.20
  @@ -51,7 +51,7 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a> (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.19 $ $Date: 2001/08/20 20:23:52 $
  + * @version CVS $Revision: 1.20 $ $Date: 2001/08/22 03:51:05 $
    */
   public class Cocoon extends AbstractLoggable implements ThreadSafe, Component, Initializable, Disposable, Modifiable, Processor, Contextualizable {
       /** The application context */
  @@ -336,6 +336,8 @@
   
       public void dispose() {
           this.componentManager.dispose();
  +        if (this.configurationFile != null)
  +            this.configurationFile.recycle();
           this.disposed = true;
       }
   
  
  
  
  1.14      +4 -3      xml-cocoon2/src/org/apache/cocoon/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Main.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Main.java	2001/08/20 16:18:05	1.13
  +++ Main.java	2001/08/22 03:51:05	1.14
  @@ -50,7 +50,7 @@
    * Command line entry point.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.13 $ $Date: 2001/08/20 16:18:05 $
  + * @version CVS $Revision: 1.14 $ $Date: 2001/08/22 03:51:05 $
    */
   
   public class Main {
  @@ -520,8 +520,9 @@
           final HashMap translatedLinks = new HashMap();
           final Iterator i = this.getLinks(deparameterizedURI, parameters).iterator();
           while (i.hasNext()) {
  -            String relativeLink = (String) i.next();
  +            String link = (String) i.next();
               // Fix relative links starting with "?"
  +            String relativeLink = link;
               if(relativeLink.startsWith("?")){
                   relativeLink = pageURI + relativeLink;
               }
  @@ -536,7 +537,7 @@
               }
   
               final String translatedRelativeLink = NetUtils.relativize(path, translatedAbsoluteLink);
  -            translatedLinks.put(relativeLink, translatedRelativeLink);
  +            translatedLinks.put(link, translatedRelativeLink);
           }
   
           // Process URI
  
  
  
  1.4       +2 -2      xml-cocoon2/src/org/apache/cocoon/ProcessingException.java
  
  Index: ProcessingException.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/ProcessingException.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProcessingException.java	2001/08/20 13:55:09	1.3
  +++ ProcessingException.java	2001/08/22 03:51:05	1.4
  @@ -18,7 +18,7 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.3 $ $Date: 2001/08/20 13:55:09 $
  + * @version CVS $Revision: 1.4 $ $Date: 2001/08/22 03:51:05 $
    */
   public class ProcessingException extends CascadingException {
   
  @@ -50,7 +50,7 @@
           StringBuffer s = new StringBuffer();
           s.append(super.toString());
           if(getCause()!=null) {
  -            s.append(':');
  +            s.append(": ");
               s.append(getCause().toString());
           }
           return s.toString();
  
  
  
  1.9       +17 -16    xml-cocoon2/src/org/apache/cocoon/acting/AbstractComplementaryConfigurableAction.java
  
  Index: AbstractComplementaryConfigurableAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/AbstractComplementaryConfigurableAction.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractComplementaryConfigurableAction.java	2001/08/20 13:55:09	1.8
  +++ AbstractComplementaryConfigurableAction.java	2001/08/22 03:51:05	1.9
  @@ -26,7 +26,7 @@
    * effective.  The name of the root configuration element is irrelevant.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.8 $ $Date: 2001/08/20 13:55:09 $
  + * @version CVS $Revision: 1.9 $ $Date: 2001/08/22 03:51:05 $
    */
   public abstract class AbstractComplementaryConfigurableAction extends ConfigurableComposerAction {
       private static Map configurations = new HashMap();
  @@ -70,27 +70,28 @@
                       sourceHandler = (SourceHandler) this.manager.lookup(SourceHandler.ROLE);
                       resource = sourceHandler.getSource(null, descriptor);
   
  -		    if (conf == null || conf.lastModified < resource.getLastModified()) {
  -			getLogger().debug("(Re)Loading " + descriptor);
  -			if (conf == null) 
  -			    conf = new ConfigurationHelper();
  +                    if (conf == null || conf.lastModified < resource.getLastModified()) {
  +                        getLogger().debug("(Re)Loading " + descriptor);
  +                        if (conf == null) 
  +                            conf = new ConfigurationHelper();
   			
  -			SAXConfigurationHandler builder = new SAXConfigurationHandler();
  -			resource.stream(builder);
  +                        SAXConfigurationHandler builder = new SAXConfigurationHandler();
  +                        resource.stream(builder);
   			
  -			conf.lastModified = resource.getLastModified();
  -			conf.configuration = builder.getConfiguration();
  +                        conf.lastModified = resource.getLastModified();
  +                        conf.configuration = builder.getConfiguration();
   			
  -			this.cacheConfiguration(descriptor, conf);
  -		    } else {
  -			getLogger().debug("Using cached configuration for " + descriptor);
  -		    }
  -		} catch (Exception e) {
  -		    getLogger().error("Could not configure Database mapping environment", e);
  +                        this.cacheConfiguration(descriptor, conf);
  +                    } else {
  +                        getLogger().debug("Using cached configuration for " + descriptor);
  +                    }
  +                } catch (Exception e) {
  +                    getLogger().error("Could not configure Database mapping environment", e);
                       throw new ConfigurationException("Error trying to load configurations for resource: " + (resource == null ? "null" : resource.getSystemId()));
                   } finally {
  +                    if (resource != null) resource.recycle();
                       if (sourceHandler != null) this.manager.release((Component) sourceHandler);
  -		}
  +                }
   	    } else {
   		getLogger().debug("Using fixed cached configuration for " + descriptor);
   	    }
  
  
  
  1.9       +7 -2      xml-cocoon2/src/org/apache/cocoon/acting/ResourceExistsAction.java
  
  Index: ResourceExistsAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/ResourceExistsAction.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ResourceExistsAction.java	2001/08/20 13:55:09	1.8
  +++ ResourceExistsAction.java	2001/08/22 03:51:05	1.9
  @@ -9,6 +9,7 @@
   
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.environment.Redirector;
  +import org.apache.cocoon.environment.Source;
   import org.apache.cocoon.environment.SourceResolver;
   
   import java.util.Collections;
  @@ -21,18 +22,22 @@
    * null otherwise. It has only been tested with context urls.
    *
    * @author <a href="mailto:balld@apache.org">Donald Ball</a>
  - * @version CVS $Revision: 1.8 $ $Date: 2001/08/20 13:55:09 $
  + * @version CVS $Revision: 1.9 $ $Date: 2001/08/22 03:51:05 $
    */
   public class ResourceExistsAction extends ComposerAction {
   
       public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception {
           HashMap results = new HashMap();
           String urlstring = parameters.getParameter("url",null);
  +        Source src = null;
           try {
  -            resolver.resolve(urlstring).getInputStream();
  +            src = resolver.resolve(urlstring);
  +            src.getInputStream();
           } catch (Exception e) {
               getLogger().debug("ResourceExistsAction: exception: ",e);
               return null;
  +        } finally {
  +            if (src != null) src.recycle();
           }
           return Collections.unmodifiableMap(results);
       }
  
  
  
  1.18      +128 -120  xml-cocoon2/src/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ProgramGeneratorImpl.java	2001/08/20 13:55:10	1.17
  +++ ProgramGeneratorImpl.java	2001/08/22 03:51:05	1.18
  @@ -43,7 +43,7 @@
   /**
    * The default implementation of <code>ProgramGenerator</code>
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.17 $ $Date: 2001/08/20 13:55:10 $
  + * @version CVS $Revision: 1.18 $ $Date: 2001/08/22 03:51:05 $
    */
   public class ProgramGeneratorImpl extends AbstractLoggable
       implements ProgramGenerator, Contextualizable, Composable, Configurable, ThreadSafe, Disposable {
  @@ -148,99 +148,45 @@
           throws Exception {
   
           Source source = resolver.resolve(fileName);
  -
  -        // Set filenames
  -        StringBuffer contextFilename = new StringBuffer(this.rootPackage.replace('.', File.separatorChar));
  -        contextFilename.append(File.separator);
  -        String id = source.getSystemId();
  -        if(id.startsWith(this.contextDir)) {
  -            // VG: File is located under contextDir, using relative file name
  -            contextFilename.append(id.substring(this.contextDir.length()));
  -        } else {
  -            // VG: File is located outside of contextDir, using systemId
  -            getLogger().debug("Loading from external source " + id);
  -            contextFilename.append(id);
  -        }
  -        String normalizedName = IOUtils.normalizedFilename(contextFilename.toString());
  -
  -        // Ensure no 2 requests for the same file overlap
  -        Class program = null;
  -        CompiledComponent programInstance = null;
  -
  -        // Attempt to load program object from cache
           try {
  -            programInstance = (CompiledComponent) select(normalizedName);
  -        } catch (Exception e) {
  -            getLogger().debug("The instance was not accessible, creating it now.");
  -        }
  -
  -        if ((programInstance == null) && this.preload) {
  -            String className = normalizedName.replace(File.separatorChar, '.');
  -
  +            // Set filenames
  +            StringBuffer contextFilename = new StringBuffer(this.rootPackage.replace('.', File.separatorChar));
  +            contextFilename.append(File.separator);
  +            String id = source.getSystemId();
  +            if(id.startsWith(this.contextDir)) {
  +                // VG: File is located under contextDir, using relative file name
  +                contextFilename.append(id.substring(this.contextDir.length()));
  +            } else {
  +                // VG: File is located outside of contextDir, using systemId
  +                getLogger().debug("Loading from external source " + id);
  +                contextFilename.append(id);
  +            }
  +            String normalizedName = IOUtils.normalizedFilename(contextFilename.toString());
  +    
  +            // Ensure no 2 requests for the same file overlap
  +            Class program = null;
  +            CompiledComponent programInstance = null;
  +    
  +            // Attempt to load program object from cache
               try {
  -                program = this.classManager.loadClass(className);
  -                this.addCompiledComponent(newManager, normalizedName, program);
                   programInstance = (CompiledComponent) select(normalizedName);
               } catch (Exception e) {
  -                getLogger().debug("The class was not preloaded");
  +                getLogger().debug("The instance was not accessible, creating it now.");
               }
  -        }
  -
  -        if (programInstance == null) {
  -            MarkupLanguage markupLanguage = null;
  -            ProgrammingLanguage programmingLanguage = null;
  -            try {
  -                // Get markup and programming languages
  -                markupLanguage = (MarkupLanguage)this.markupSelector.select(markupLanguageName);
  -                programmingLanguage = (ProgrammingLanguage)this.languageSelector.select(programmingLanguageName);
  -                programmingLanguage.setLanguageName(programmingLanguageName);
  -                program = this.generateResource(newManager, fileName, normalizedName, markupLanguage, programmingLanguage, resolver);
  -            } catch (LanguageException le) {
  -                getLogger().debug("Language Exception", le);
  -                throw new ProcessingException("Language Exception", le);
  -            } finally {
  -                if (this.markupSelector != null) {
  -                    this.markupSelector.release(markupLanguage);
  -                }
  -
  -                if (this.languageSelector != null) {
  -                    this.languageSelector.release(programmingLanguage);
  +    
  +            if ((programInstance == null) && this.preload) {
  +                String className = normalizedName.replace(File.separatorChar, '.');
  +    
  +                try {
  +                    program = this.classManager.loadClass(className);
  +                    this.addCompiledComponent(newManager, normalizedName, program);
  +                    programInstance = (CompiledComponent) select(normalizedName);
  +                } catch (Exception e) {
  +                    getLogger().debug("The class was not preloaded");
                   }
               }
  -
  -            try {
  -                programInstance = (CompiledComponent) select(normalizedName);
  -            } catch (Exception cme) {
  -                getLogger().debug("Can't load ServerPage", cme);
  -            }
  -        }
  -
  -        if (this.autoReload == false) {
  -            return programInstance;
  -        }
  -
  -        /*
  -         * FIXME: It's the program (not the instance) that must
  -         * be queried for changes!!!
  -         */
  -
  -        if (programInstance != null && programInstance.modifiedSince(source.getLastModified())) {
  -            // Release the component.
  -            release(programInstance);
  -
  -            // Unload program
  -            ProgrammingLanguage programmingLanguage = (ProgrammingLanguage)this.languageSelector.select(programmingLanguageName);
  -            programmingLanguage.setLanguageName(programmingLanguageName);
  -            programmingLanguage.unload(program, normalizedName, this.workDir);
  -            this.cache.removeGenerator(normalizedName);
  -
  -            // Invalidate previous program/instance pair
  -            program = null;
  -            programInstance = null;
  -        }
  -
  -        if (programInstance == null) {
  -            if (program == null) {
  +    
  +            if (programInstance == null) {
                   MarkupLanguage markupLanguage = null;
                   ProgrammingLanguage programmingLanguage = null;
                   try {
  @@ -253,15 +199,72 @@
                       getLogger().debug("Language Exception", le);
                       throw new ProcessingException("Language Exception", le);
                   } finally {
  -                    this.markupSelector.release(markupLanguage);
  -                    this.languageSelector.release(programmingLanguage);
  +                    if (this.markupSelector != null) {
  +                        this.markupSelector.release(markupLanguage);
  +                    }
  +    
  +                    if (this.languageSelector != null) {
  +                        this.languageSelector.release(programmingLanguage);
  +                    }
                   }
  +    
  +                try {
  +                    programInstance = (CompiledComponent) select(normalizedName);
  +                } catch (Exception cme) {
  +                    getLogger().debug("Can't load ServerPage", cme);
  +                }
               }
  -            // Instantiate
  -            programInstance = (CompiledComponent) select(normalizedName);
  -        }
  +    
  +            if (this.autoReload == false) {
  +                return programInstance;
  +            }
  +    
  +            /*
  +             * FIXME: It's the program (not the instance) that must
  +             * be queried for changes!!!
  +             */
  +    
  +            if (programInstance != null && programInstance.modifiedSince(source.getLastModified())) {
  +                // Release the component.
  +                release(programInstance);
  +    
  +                // Unload program
  +                ProgrammingLanguage programmingLanguage = (ProgrammingLanguage)this.languageSelector.select(programmingLanguageName);
  +                programmingLanguage.setLanguageName(programmingLanguageName);
  +                programmingLanguage.unload(program, normalizedName, this.workDir);
  +                this.cache.removeGenerator(normalizedName);
  +    
  +                // Invalidate previous program/instance pair
  +                program = null;
  +                programInstance = null;
  +            }
  +    
  +            if (programInstance == null) {
  +                if (program == null) {
  +                    MarkupLanguage markupLanguage = null;
  +                    ProgrammingLanguage programmingLanguage = null;
  +                    try {
  +                        // Get markup and programming languages
  +                        markupLanguage = (MarkupLanguage)this.markupSelector.select(markupLanguageName);
  +                        programmingLanguage = (ProgrammingLanguage)this.languageSelector.select(programmingLanguageName);
  +                        programmingLanguage.setLanguageName(programmingLanguageName);
  +                        program = this.generateResource(newManager, fileName, normalizedName, markupLanguage, programmingLanguage, resolver);
  +                    } catch (LanguageException le) {
  +                        getLogger().debug("Language Exception", le);
  +                        throw new ProcessingException("Language Exception", le);
  +                    } finally {
  +                        this.markupSelector.release(markupLanguage);
  +                        this.languageSelector.release(programmingLanguage);
  +                    }
  +                }
  +                // Instantiate
  +                programInstance = (CompiledComponent) select(normalizedName);
  +            }
   
  -        return programInstance;
  +            return programInstance;
  +        } finally {
  +            source.recycle();
  +        }
       }
   
       private Class generateResource(ComponentManager newManager,
  @@ -271,36 +274,41 @@
                                      ProgrammingLanguage programmingLanguage,
                                      SourceResolver resolver)
           throws Exception {
  -
  -        // Input Source
  -        InputSource is = resolver.resolve(fileName).getInputSource();
  -        // Generate code
  -        String code = markupLanguage.generateCode(is, normalizedName, programmingLanguage, resolver);
  -        String encoding = markupLanguage.getEncoding();
  -        // Format source code if applicable
  -        CodeFormatter codeFormatter = programmingLanguage.getCodeFormatter();
  -        if (codeFormatter != null) {
  -            code = codeFormatter.format(code, encoding);
  -        }
  -        // Store generated code
  -        String sourceFilename = normalizedName + "." + programmingLanguage.getSourceExtension();
  -        repository.store(sourceFilename, code);
  -        // [Compile]/Load generated program
  -        Class program = programmingLanguage.load(normalizedName, this.workDir, markupLanguage.getEncoding());
  -        // Store generated program in cache
  -        this.addCompiledComponent(newManager, normalizedName, program);
   
  -        // FIXME: Do we want this functionality?  All analysis says no.
  -        if (markupLanguage.getClass().equals(SitemapMarkupLanguage.class)) {
  -            try {
  -                select("sitemap");
  -            } catch (Exception e) {
  -                // If the root sitemap has not been compiled, add an alias here.
  -                this.addCompiledComponent(newManager, "sitemap", program);
  +        Source source = resolver.resolve(fileName);
  +        try { 
  +            // Input Source
  +            InputSource is = source.getInputSource();
  +            // Generate code
  +            String code = markupLanguage.generateCode(is, normalizedName, programmingLanguage, resolver);
  +            String encoding = markupLanguage.getEncoding();
  +            // Format source code if applicable
  +            CodeFormatter codeFormatter = programmingLanguage.getCodeFormatter();
  +            if (codeFormatter != null) {
  +                code = codeFormatter.format(code, encoding);
               }
  +            // Store generated code
  +            String sourceFilename = normalizedName + "." + programmingLanguage.getSourceExtension();
  +            repository.store(sourceFilename, code);
  +            // [Compile]/Load generated program
  +            Class program = programmingLanguage.load(normalizedName, this.workDir, markupLanguage.getEncoding());
  +            // Store generated program in cache
  +            this.addCompiledComponent(newManager, normalizedName, program);
  +    
  +            // FIXME: Do we want this functionality?  All analysis says no.
  +            if (markupLanguage.getClass().equals(SitemapMarkupLanguage.class)) {
  +                try {
  +                    select("sitemap");
  +                } catch (Exception e) {
  +                    // If the root sitemap has not been compiled, add an alias here.
  +                    this.addCompiledComponent(newManager, "sitemap", program);
  +                }
  +            }
  +    
  +            return program;
  +        } finally {
  +            source.recycle();
           }
  -
  -        return program;
       }
   
       private final void addCompiledComponent(ComponentManager newManager,
  
  
  
  1.8       +8 -3      xml-cocoon2/src/org/apache/cocoon/components/language/markup/AbstractMarkupLanguage.java
  
  Index: AbstractMarkupLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/AbstractMarkupLanguage.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractMarkupLanguage.java	2001/08/20 13:55:11	1.7
  +++ AbstractMarkupLanguage.java	2001/08/22 03:51:05	1.8
  @@ -50,7 +50,7 @@
    * logicsheets as the only means of code generation. Code generation should be decoupled from this context!!!
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  - * @version CVS $Revision: 1.7 $ $Date: 2001/08/20 13:55:11 $
  + * @version CVS $Revision: 1.8 $ $Date: 2001/08/22 03:51:05 $
    */
   public abstract class AbstractMarkupLanguage extends AbstractLoggable implements MarkupLanguage, Composable, Configurable {
       /** The supported language table */
  @@ -311,8 +311,10 @@
        * @exception SAXException Logicsheet parse error
        */
       protected void addLogicsheetToList(LanguageDescriptor language, String logicsheetLocation, SourceResolver resolver)
  -        throws MalformedURLException, IOException, SAXException, ProcessingException {
  -            Source inputSource = resolver.resolve(logicsheetLocation);
  +        throws MalformedURLException, IOException, SAXException, ProcessingException
  +    {
  +        Source inputSource = resolver.resolve(logicsheetLocation);
  +        try {
               URL url = new URL(inputSource.getSystemId());
               getLogger().debug("Logicsheet Used:" + url.toExternalForm());
   
  @@ -353,6 +355,9 @@
                       }
                   }
               }
  +        } finally {
  +            inputSource.recycle();
  +        }
       }
       //
       // Inner classes
  
  
  
  1.11      +28 -27    xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPFormValidatorHelper.java
  
  Index: XSPFormValidatorHelper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPFormValidatorHelper.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XSPFormValidatorHelper.java	2001/08/20 13:55:11	1.10
  +++ XSPFormValidatorHelper.java	2001/08/22 03:51:05	1.11
  @@ -27,7 +27,7 @@
    * The <code>ValidatorActionResult</code> object helper
    *
    * @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
  - * @version CVS $Revision: 1.10 $ $Date: 2001/08/20 13:55:11 $
  + * @version CVS $Revision: 1.11 $ $Date: 2001/08/22 03:51:05 $
    */
   public class XSPFormValidatorHelper {
     /**
  @@ -451,34 +451,35 @@
   
           synchronized (XSPFormValidatorHelper.configurations) {
               conf = (ConfigurationHelper) XSPFormValidatorHelper.configurations.get(descriptor);
  -        Source source = null;
  +            Source source = null;
               SourceHandler sourceHandler = null;
  -        try {
  -            sourceHandler = (SourceHandler) manager.lookup(SourceHandler.ROLE);
  -            source = sourceHandler.getSource(null, descriptor);
  -
  -        if (conf == null || ( reloadable && conf.lastModified < source.getLastModified())) {
  -            logger.debug("XSPFormValidatorHelper.getConfiguration: (Re)Loading " + descriptor);
  -
  -            if (conf == null)
  -            conf = new ConfigurationHelper();
  -
  -            SAXConfigurationHandler builder = new SAXConfigurationHandler();
  -                    source.stream(builder);
  -
  -            conf.lastModified = source.getLastModified();
  -            conf.configuration = builder.getConfiguration();
  -
  -            XSPFormValidatorHelper.cacheConfiguration(descriptor, conf);
  -        } else {
  -            logger.debug("XSPFormValidatorHelper.getConfiguration: Using cached configuration for " + descriptor);
  -        }
  -        } catch (Exception e) {
  -        logger.error("XSPFormValidatorHelper.getConfiguration: Could not configure Database mapping environment", e);
  -        throw new ConfigurationException("Error trying to load configurations for resource: " + source.getSystemId());
  -        } finally {
  +            try {
  +                sourceHandler = (SourceHandler) manager.lookup(SourceHandler.ROLE);
  +                source = sourceHandler.getSource(null, descriptor);
  +    
  +                if (conf == null || ( reloadable && conf.lastModified < source.getLastModified())) {
  +                    logger.debug("XSPFormValidatorHelper.getConfiguration: (Re)Loading " + descriptor);
  +        
  +                    if (conf == null)
  +                    conf = new ConfigurationHelper();
  +        
  +                    SAXConfigurationHandler builder = new SAXConfigurationHandler();
  +                            source.stream(builder);
  +        
  +                    conf.lastModified = source.getLastModified();
  +                    conf.configuration = builder.getConfiguration();
  +        
  +                    XSPFormValidatorHelper.cacheConfiguration(descriptor, conf);
  +                } else {
  +                    logger.debug("XSPFormValidatorHelper.getConfiguration: Using cached configuration for " + descriptor);
  +                }
  +            } catch (Exception e) {
  +                logger.error("XSPFormValidatorHelper.getConfiguration: Could not configure Database mapping environment", e);
  +                throw new ConfigurationException("Error trying to load configurations for resource: " + source.getSystemId());
  +            } finally {
  +                if (source != null) source.recycle();
                  if (sourceHandler != null) manager.release((Component) sourceHandler);
  -        }
  +            }
           }
   
           return conf.configuration;
  
  
  
  1.16      +6 -2      xml-cocoon2/src/org/apache/cocoon/components/source/SitemapSource.java
  
  Index: SitemapSource.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/source/SitemapSource.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- SitemapSource.java	2001/08/20 13:55:13	1.15
  +++ SitemapSource.java	2001/08/22 03:51:05	1.16
  @@ -45,7 +45,7 @@
    * Description of a source which is defined by a pipeline.
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.15 $ $Date: 2001/08/20 13:55:13 $
  + * @version CVS $Revision: 1.16 $ $Date: 2001/08/22 03:51:05 $
    */
   
   public final class SitemapSource
  @@ -321,8 +321,12 @@
           this.pipeline = null;
           this.lastModificationDate = 0;
           this.environment.reset();
  +        if (this.redirectSource != null) this.redirectSource.recycle();
           this.redirectSource = null;
           this.exception = null;
       }
  -}
   
  +    public void recycle() {
  +        reset();
  +    }
  +}
  
  
  
  1.9       +3 -1      xml-cocoon2/src/org/apache/cocoon/components/source/URLSource.java
  
  Index: URLSource.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/source/URLSource.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- URLSource.java	2001/08/20 13:55:13	1.8
  +++ URLSource.java	2001/08/22 03:51:05	1.9
  @@ -30,7 +30,7 @@
    * Description of a source which is described by an URL.
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.8 $ $Date: 2001/08/20 13:55:13 $
  + * @version CVS $Revision: 1.9 $ $Date: 2001/08/22 03:51:05 $
    */
   
   public final class URLSource
  @@ -342,5 +342,7 @@
           }
       }
   
  +    public void recycle() {
  +    }
   }
   
  
  
  
  1.10      +3 -2      xml-cocoon2/src/org/apache/cocoon/environment/Source.java
  
  Index: Source.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/Source.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Source.java	2001/08/20 13:55:13	1.9
  +++ Source.java	2001/08/22 03:51:05	1.10
  @@ -8,6 +8,7 @@
   
   package org.apache.cocoon.environment;
   
  +import org.apache.avalon.excalibur.pool.Recyclable;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.xml.XMLConsumer;
   import org.xml.sax.ContentHandler;
  @@ -23,10 +24,10 @@
    * for accessing any resource (URL, local file etc).
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.9 $ $Date: 2001/08/20 13:55:13 $
  + * @version CVS $Revision: 1.10 $ $Date: 2001/08/22 03:51:05 $
    */
   
  -public interface Source {
  +public interface Source extends Recyclable {
       /**
        * Get the last modification date of the source or 0 if it
        * is not possible to determine the date.
  
  
  
  1.11      +5 -2      xml-cocoon2/src/org/apache/cocoon/generation/DirectoryGenerator.java
  
  Index: DirectoryGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/DirectoryGenerator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DirectoryGenerator.java	2001/08/20 13:55:15	1.10
  +++ DirectoryGenerator.java	2001/08/22 03:51:05	1.11
  @@ -61,7 +61,7 @@
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:conny@smb-tec.com">Conny Krappatsch</a>
    *         (SMB GmbH) for Virbus AG
  - * @version CVS $Revision: 1.10 $ $Date: 2001/08/20 13:55:15 $ */
  + * @version CVS $Revision: 1.11 $ $Date: 2001/08/22 03:51:05 $ */
   
   public class DirectoryGenerator extends ComposerGenerator implements Recyclable {
   
  @@ -160,8 +160,9 @@
       public void generate()
       throws SAXException, ProcessingException {
           String directory = super.source;
  +        Source inputSource = null;
           try {
  -            Source inputSource =  this.resolver.resolve(directory);
  +            inputSource = this.resolver.resolve(directory);
               directory = inputSource.getSystemId();
               if (inputSource.isFile() == false) {
                   throw new ResourceNotFoundException(directory + " is not a directory.");
  @@ -183,6 +184,8 @@
               getLogger().warn("Could not read directory " + directory, ioe);
               throw new ResourceNotFoundException("Could not read directory "
                   + directory, ioe);
  +        } finally {
  +            if (inputSource != null) inputSource.recycle();
           }
       }
   
  
  
  
  1.19      +2 -1      xml-cocoon2/src/org/apache/cocoon/generation/FileGenerator.java
  
  Index: FileGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/FileGenerator.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- FileGenerator.java	2001/08/20 13:55:15	1.18
  +++ FileGenerator.java	2001/08/22 03:51:05	1.19
  @@ -35,7 +35,7 @@
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.18 $ $Date: 2001/08/20 13:55:15 $
  + * @version CVS $Revision: 1.19 $ $Date: 2001/08/22 03:51:05 $
    */
   public class FileGenerator extends ComposerGenerator
   implements Cacheable, Recyclable {
  @@ -57,6 +57,7 @@
        */
       public void recycle() {
           super.recycle();
  +        this.inputSource.recycle();
           this.inputSource = null;
       }
   
  
  
  
  1.12      +2 -1      xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java
  
  Index: HTMLGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/HTMLGenerator.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- HTMLGenerator.java	2001/08/21 17:59:52	1.11
  +++ HTMLGenerator.java	2001/08/22 03:51:05	1.12
  @@ -39,7 +39,7 @@
   /**
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.11 $ $Date: 2001/08/21 17:59:52 $
  + * @version CVS $Revision: 1.12 $ $Date: 2001/08/22 03:51:05 $
    */
   public class HTMLGenerator extends ComposerGenerator implements Cacheable, Recyclable {
   
  @@ -55,6 +55,7 @@
        */
       public void recycle() {
           super.recycle();
  +        this.inputSource.recycle();
           this.inputSource = null;
           this.xpath = null;
       }
  
  
  
  1.16      +6 -2      xml-cocoon2/src/org/apache/cocoon/generation/JspGenerator.java
  
  Index: JspGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/JspGenerator.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- JspGenerator.java	2001/08/20 13:55:15	1.15
  +++ JspGenerator.java	2001/08/22 03:51:05	1.16
  @@ -14,6 +14,7 @@
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.jsp.JSPEngine;
   import org.apache.cocoon.components.parser.Parser;
  +import org.apache.cocoon.environment.Source;
   import org.apache.cocoon.environment.http.HttpEnvironment;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  @@ -31,7 +32,7 @@
    * results into SAX events.
    *
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  - * @version CVS $Revision: 1.15 $ $Date: 2001/08/20 13:55:15 $
  + * @version CVS $Revision: 1.16 $ $Date: 2001/08/22 03:51:05 $
    */
   public class JspGenerator extends ServletGenerator implements Recyclable, Configurable {
   
  @@ -58,8 +59,10 @@
   
           JSPEngine engine = null;
           Parser parser = null;
  +        Source src = null;
           try {
  -            String url = this.resolver.resolve(this.source).getSystemId();
  +            src = this.resolver.resolve(this.source);
  +            String url = src.getSystemId();
               // Guarantee src parameter is a file
               if (!url.startsWith("file:/"))
                   throw new IOException("Protocol not supported: " + url);
  @@ -92,6 +95,7 @@
               getLogger().debug("Exception in JspGenerator.generate()", e);
               throw new ProcessingException("Exception JspGenerator.generate()",e);
           } finally {
  +            if (src != null) src.recycle();
               if (parser != null) this.manager.release(parser);
               if (engine != null) this.manager.release(engine);
           }
  
  
  
  1.9       +8 -6      xml-cocoon2/src/org/apache/cocoon/generation/PhpGenerator.java
  
  Index: PhpGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/PhpGenerator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PhpGenerator.java	2001/08/20 13:55:15	1.8
  +++ PhpGenerator.java	2001/08/22 03:51:05	1.9
  @@ -32,7 +32,7 @@
    * results into SAX events.
    *
    * @author <a href="mailto:rubys@us.ibm.com">Sam Ruby</a>
  - * @version CVS $Revision: 1.8 $ $Date: 2001/08/20 13:55:15 $
  + * @version CVS $Revision: 1.9 $ $Date: 2001/08/22 03:51:05 $
    */
   public class PhpGenerator extends ServletGenerator implements Recyclable {
   
  @@ -124,13 +124,14 @@
           }
   
           // ensure that we are serving a file...
  -        Source inputSource = this.resolver.resolve(this.source);
  -        String systemId = inputSource.getSystemId();
  -        if (!systemId.startsWith("file:/"))
  -            throw new IOException("protocol not supported: " + systemId);
  -
  +        Source inputSource = null;
           Parser parser = null;
           try {
  +            inputSource = this.resolver.resolve(this.source);
  +            String systemId = inputSource.getSystemId();
  +            if (!systemId.startsWith("file:/"))
  +                throw new IOException("protocol not supported: " + systemId);
  +
               // construct both ends of the pipe
               PipedInputStream input = new PipedInputStream();
   
  @@ -157,6 +158,7 @@
               getLogger().debug("PhpGenerator.generate()", e);
               throw new IOException(e.toString());
           } finally {
  +            if (inputSource != null) inputSource.recycle();
               if (parser != null) this.manager.release(parser);
           }
       }
  
  
  
  1.11      +2 -1      xml-cocoon2/src/org/apache/cocoon/generation/ScriptGenerator.java
  
  Index: ScriptGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/ScriptGenerator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ScriptGenerator.java	2001/08/20 13:55:15	1.10
  +++ ScriptGenerator.java	2001/08/22 03:51:05	1.11
  @@ -45,7 +45,7 @@
    * </pre>
    *
    * @author <a href="mailto:jafoster@engmail.uwaterloo.ca">Jason Foster</a>
  - * @version CVS $Revision: 1.10 $ $Date: 2001/08/20 13:55:15 $
  + * @version CVS $Revision: 1.11 $ $Date: 2001/08/22 03:51:05 $
    */
   public class ScriptGenerator extends ComposerGenerator implements Configurable,
   Recyclable {
  @@ -101,6 +101,7 @@
   
       public void recycle() {
           super.recycle();
  +        this.inputSource.recycle();
           this.inputSource = null;
       }
   
  
  
  
  1.15      +2 -1      xml-cocoon2/src/org/apache/cocoon/generation/ServerPagesGenerator.java
  
  Index: ServerPagesGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/ServerPagesGenerator.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ServerPagesGenerator.java	2001/08/20 13:55:15	1.14
  +++ ServerPagesGenerator.java	2001/08/22 03:51:05	1.15
  @@ -39,7 +39,7 @@
    * delegating actual SAX event generation.
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.14 $ $Date: 2001/08/20 13:55:15 $
  + * @version CVS $Revision: 1.15 $ $Date: 2001/08/22 03:51:05 $
    */
   public class ServerPagesGenerator
     extends ServletGenerator
  @@ -441,6 +441,7 @@
           if (generator != null)
               programGenerator.release(generator);
           this.generator = null;
  +        this.inputSource.recycle();
           this.inputSource = null;
           this.eventStack.clear();
       }
  
  
  
  1.8       +2 -1      xml-cocoon2/src/org/apache/cocoon/reading/ResourceReader.java
  
  Index: ResourceReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/reading/ResourceReader.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ResourceReader.java	2001/08/20 13:55:16	1.7
  +++ ResourceReader.java	2001/08/22 03:51:05	1.8
  @@ -31,7 +31,7 @@
   /**
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.7 $ $Date: 2001/08/20 13:55:16 $
  + * @version CVS $Revision: 1.8 $ $Date: 2001/08/22 03:51:05 $
    *
    * The <code>ResourceReader</code> component is used to serve binary data
    * in a sitemap pipeline. It makes use of HTTP Headers to determine if
  @@ -73,6 +73,7 @@
   
       public void recycle() {
           super.recycle();
  +        this.inputSource.recycle();
           this.inputSource = null;
       }
   
  
  
  
  1.15      +4 -1      xml-cocoon2/src/org/apache/cocoon/sitemap/ContentAggregator.java
  
  Index: ContentAggregator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/ContentAggregator.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ContentAggregator.java	2001/08/20 13:55:17	1.14
  +++ ContentAggregator.java	2001/08/22 03:51:06	1.15
  @@ -32,11 +32,12 @@
   import java.io.IOException;
   import java.util.ArrayList;
   import java.util.Map;
  +import java.util.Iterator;
   
   /**
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Id: ContentAggregator.java,v 1.14 2001/08/20 13:55:17 dims Exp $
  + * @version CVS $Id: ContentAggregator.java,v 1.15 2001/08/22 03:51:06 vgritsenko Exp $
    */
   public class ContentAggregator extends ContentHandlerWrapper implements Generator, Cacheable, Composable {
   
  @@ -257,6 +258,8 @@
           this.rootElement = null;
           this.rootElementNS = null;
           this.rootElementNSPrefix = null;
  +        for (Iterator i = this.parts.iterator(); i.hasNext();)
  +            ((Part)i.next()).source.recycle();
           this.parts.clear();
           this.currentNS.clear();
           this.xmlConsumer = null;
  
  
  
  1.18      +6 -1      xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java
  
  Index: Handler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Handler.java	2001/08/20 13:55:17	1.17
  +++ Handler.java	2001/08/22 03:51:06	1.18
  @@ -40,7 +40,7 @@
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.17 $ $Date: 2001/08/20 13:55:17 $
  + * @version CVS $Revision: 1.18 $ $Date: 2001/08/22 03:51:06 $
    */
   public class Handler extends AbstractLoggable
   implements Runnable, Contextualizable, Composable, Processor, Disposable, SourceResolver {
  @@ -230,6 +230,7 @@
               }
               this.regeneration = null;
               this.isRegenerationRunning = false;
  +            this.contextSource.recycle();
               this.contextSource = null;
           }
       }
  @@ -251,6 +252,10 @@
        * dispose
        */
       public void dispose() {
  +        if (this.source != null) {
  +            this.source.recycle();
  +            this.source = null;
  +        }
           if (this.sourceHandler != null) {
               manager.release((Component)this.sourceHandler);
               this.sourceHandler = null;
  
  
  
  1.6       +7 -2      xml-cocoon2/src/org/apache/cocoon/transformation/CIncludeTransformer.java
  
  Index: CIncludeTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/CIncludeTransformer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CIncludeTransformer.java	2001/08/20 13:55:17	1.5
  +++ CIncludeTransformer.java	2001/08/22 03:51:06	1.6
  @@ -12,6 +12,7 @@
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.environment.Source;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.xml.IncludeXMLConsumer;
   import org.xml.sax.Attributes;
  @@ -31,7 +32,7 @@
    * which surrounds the included content.
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.5 $ $Date: 2001/08/20 13:55:17 $ $Author: dims $
  + * @version CVS $Revision: 1.6 $ $Date: 2001/08/22 03:51:06 $ $Author: vgritsenko $
    */
   public class CIncludeTransformer extends AbstractTransformer
   implements Recyclable, Composable {
  @@ -123,14 +124,18 @@
                                  attrs);
           }
   
  +        Source source = null;
           try {
  -            this.sourceResolver.resolve(src).stream(consumer);
  +            source = this.sourceResolver.resolve(src);
  +            source.stream(consumer);
           } catch (IOException e) {
               getLogger().error("CIncludeTransformer", e);
               throw new SAXException("CIncludeTransformer could not read resource", e);
           } catch (ProcessingException e){
               getLogger().error("Could not stream input", e);
               throw new SAXException("Exception in CIncludeTransformer",e);
  +        } finally {
  +            source.recycle();
           }
   
           if (!"".equals(element)) {
  
  
  
  1.30      +2 -1      xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java
  
  Index: TraxTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- TraxTransformer.java	2001/08/20 13:55:17	1.29
  +++ TraxTransformer.java	2001/08/22 03:51:06	1.30
  @@ -80,7 +80,7 @@
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
    * @author <a href="mailto:ovidiu@cup.hp.com">Ovidiu Predescu</a>
  - * @version CVS $Id: TraxTransformer.java,v 1.29 2001/08/20 13:55:17 dims Exp $
  + * @version CVS $Id: TraxTransformer.java,v 1.30 2001/08/22 03:51:06 vgritsenko Exp $
    */
   public class TraxTransformer extends AbstractTransformer
   implements Transformer, Composable, Recyclable, Configurable, Cacheable, Disposable {
  @@ -410,6 +410,7 @@
           */
           this.transformerHandler = null;
           this.objectModel = null;
  +        this.inputSource.recycle();
           this.inputSource = null;
           this.par = null;
           this._useParameters = this.useParameters;
  
  
  
  1.7       +10 -4     xml-cocoon2/src/org/apache/cocoon/transformation/XTTransformer.java
  
  Index: XTTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/XTTransformer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XTTransformer.java	2001/08/20 13:55:17	1.6
  +++ XTTransformer.java	2001/08/22 03:51:06	1.7
  @@ -32,6 +32,7 @@
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.store.Store;
   import org.apache.cocoon.components.url.URLFactory;
  +import org.apache.cocoon.environment.Source;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.xml.DocumentHandlerAdapter;
   import org.apache.cocoon.xml.DocumentHandlerWrapper;
  @@ -62,7 +63,7 @@
    * This Transformer use the XT processor.
    *
    * @author <a href="mailto:ssahuc@imediation.com">Sahuc Sebastien</a>
  - * @version CVS $Revision: 1.6 $ $Date: 2001/08/20 13:55:17 $
  + * @version CVS $Revision: 1.7 $ $Date: 2001/08/22 03:51:06 $
    */
   public class XTTransformer extends DocumentHandlerWrapper
   implements Transformer, Composable, Loggable, Recyclable, Disposable {
  @@ -136,9 +137,14 @@
                   new ProcessingException(e.getMessage(),e);
               }
               loaderprocessor.setParser(saxParser.getParser());
  -            InputSource xslsrc = resolver.resolve(xsluri).getInputSource();
  -            loaderprocessor.loadStylesheet(xslsrc);
  -            if (store != null) store.store(xsluri, loaderprocessor);
  +            Source source = resolver.resolve(xsluri);
  +            try {
  +                InputSource xslsrc = source.getInputSource();
  +                loaderprocessor.loadStylesheet(xslsrc);
  +                if (store != null) store.store(xsluri, loaderprocessor);
  +            } finally {
  +                source.recycle();
  +            }
           }
   
           // Always clone the processor before using it,
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message