cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/generation FileGenerator.java
Date Mon, 05 Mar 2001 14:44:56 GMT
cziegeler    01/03/05 06:44:55

  Modified:    src/org/apache/cocoon/generation Tag: xml-cocoon2
                        FileGenerator.java
  Log:
  Fixed parser releasing
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.23  +25 -22    xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java
  
  Index: FileGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java,v
  retrieving revision 1.1.2.22
  retrieving revision 1.1.2.23
  diff -u -r1.1.2.22 -r1.1.2.23
  --- FileGenerator.java	2001/02/23 14:01:26	1.1.2.22
  +++ FileGenerator.java	2001/03/05 14:44:48	1.1.2.23
  @@ -59,7 +59,7 @@
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:cziegeler@sundn.de">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.22 $ $Date: 2001/02/23 14:01:26 $
  + * @version CVS $Revision: 1.1.2.23 $ $Date: 2001/03/05 14:44:48 $
    */
   public class FileGenerator extends ComposerGenerator implements Poolable, Configurable
{
   
  @@ -141,30 +141,33 @@
               if(cxml == null)
               {
                   Parser parser = (Parser)this.manager.lookup(Roles.PARSER);
  -                // use the xmlcompiler for local files if storing is on
  -                if (this.useStore == true && systemID.startsWith("file:") == true)
  -                {
  -                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
  -                    XMLCompiler compiler = new XMLCompiler();
  -                    compiler.setOutputStream(baos);
  -                    XMLMulticaster multicaster = new XMLMulticaster(compiler, null,
  +                try {
  +                    // use the xmlcompiler for local files if storing is on
  +                    if (this.useStore == true && systemID.startsWith("file:") ==
true)
  +                    {
  +                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
  +                        XMLCompiler compiler = new XMLCompiler();
  +                        compiler.setOutputStream(baos);
  +                        XMLMulticaster multicaster = new XMLMulticaster(compiler, null,
                                 this.contentHandler, this.lexicalHandler);
   
  -                    parser.setContentHandler(multicaster);
  -                    parser.setLexicalHandler(multicaster);
  -                    parser.parse(src);
  -
  -                    // Stored is an array of the cxml and the current time
  -                    Object[] cxmlAndTime = new Object[2];
  -                    cxmlAndTime[0] = baos.toByteArray();
  -                    cxmlAndTime[1] = new Long(System.currentTimeMillis());
  -                    store.hold(systemID, cxmlAndTime);
  -                } else {
  -                    parser.setContentHandler(this.contentHandler);
  -                    parser.setLexicalHandler(this.lexicalHandler);
  -                    parser.parse(src);
  +                        parser.setContentHandler(multicaster);
  +                        parser.setLexicalHandler(multicaster);
  +                        parser.parse(src);
  +
  +                        // Stored is an array of the cxml and the current time
  +                        Object[] cxmlAndTime = new Object[2];
  +                        cxmlAndTime[0] = baos.toByteArray();
  +                        cxmlAndTime[1] = new Long(System.currentTimeMillis());
  +                        store.hold(systemID, cxmlAndTime);
  +                    } else {
  +                        parser.setContentHandler(this.contentHandler);
  +                        parser.setLexicalHandler(this.lexicalHandler);
  +                        parser.parse(src);
  +                    }
  +                } finally {
  +                    this.manager.release((Component) parser);
                   }
  -                this.manager.release((Component) parser);
               } else {
                   // use the stored cxml
                   ByteArrayInputStream bais = new ByteArrayInputStream(cxml);
  
  
  

Mime
View raw message