cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation ServerPagesGenerator.java
Date Tue, 07 Oct 2003 16:07:33 GMT
vgritsenko    2003/10/07 09:07:33

  Modified:    src/java/org/apache/cocoon/components/language/generator
                        ProgramGeneratorImpl.java
               src/java/org/apache/cocoon/generation
                        ServerPagesGenerator.java
  Log:
  Remove release from load() method, document in javadoc
  
  Revision  Changes    Path
  1.5       +13 -6     cocoon-2.1/src/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProgramGeneratorImpl.java	12 Aug 2003 01:41:33 -0000	1.4
  +++ ProgramGeneratorImpl.java	7 Oct 2003 16:07:33 -0000	1.5
  @@ -219,14 +219,21 @@
                                     String markupLanguageName,
                                     String programmingLanguageName,
                                     SourceResolver resolver)
  -        throws Exception {
  +    throws Exception {
   
           final Source source = resolver.resolveURI(fileName);
  -        return load(newManager, source, markupLanguageName, programmingLanguageName, resolver);
  +        try {
  +            return load(newManager, source, markupLanguageName, programmingLanguageName,
resolver);
  +        } finally {
  +            resolver.release(source);
  +        }
       }
   
       /**
  -     * Load a program built from an XML document written in a <code>MarkupLanguage</code>
  +     * Load a program built from an XML document written in a <code>MarkupLanguage</code>.
  +     *
  +     * This method does not releases passed source object. Caller of the method must release
  +     * source when needed.
        *
        * @param source The input document's <code>File</code>
        * @param markupLanguageName The <code>MarkupLanguage</code> in which the
input document is written
  @@ -239,7 +246,7 @@
                                     String markupLanguageName,
                                     String programmingLanguageName,
                                     SourceResolver resolver)
  -            throws Exception {
  +    throws Exception {
   
           final String id = source.getURI();
   
  @@ -399,9 +406,9 @@
               if (programInstance instanceof Recomposable) {
                   ((Recomposable) programInstance).recompose(newManager);
               }
  +
               return (programInstance);
           } finally {
  -            resolver.release(source);
               this.markupSelector.release(markupLanguage);
               this.languageSelector.release(programmingLanguage);
           }
  
  
  
  1.4       +13 -9     cocoon-2.1/src/java/org/apache/cocoon/generation/ServerPagesGenerator.java
  
  Index: ServerPagesGenerator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/generation/ServerPagesGenerator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServerPagesGenerator.java	4 Sep 2003 14:53:51 -0000	1.3
  +++ ServerPagesGenerator.java	7 Oct 2003 16:07:33 -0000	1.4
  @@ -143,10 +143,11 @@
        *         is currently not cacheable.
        */
       public Serializable getKey() {
  -        Object generatorkey = generator.getKey();
  -        if (generatorkey==null)
  +        Object key = generator.getKey();
  +        if (key == null) {
               return this.inputSource.getURI();
  -        return this.inputSource.getURI() + '-' + generatorkey;
  +        }
  +        return this.inputSource.getURI() + '-' + key;
       }
   
       /**
  @@ -198,6 +199,7 @@
           } catch (SourceException se) {
               throw SourceUtil.handle(se);
           }
  +
           try {
               this.generator = (AbstractServerPage) programGenerator.load(this.manager,
                       this.inputSource, markupLanguage, programmingLanguage, this.resolver);
  @@ -255,7 +257,7 @@
           locator.setSystemId(this.inputSource.getURI());
           this.contentHandler.setDocumentLocator(locator);
   
  -        // log exception and ensure that generator is released.
  +        // Log exception and ensure that generator is released.
           try {
               generator.generate();
           } catch (IOException e) {
  @@ -271,8 +273,9 @@
               getLogger().debug("Exception in generate()", e);
               throw new ProcessingException("Exception in ServerPagesGenerator.generate()",
e);
           } finally {
  -            if (generator != null)
  +            if (generator != null) {
                   programGenerator.release(generator);
  +            }
               generator = null;
           }
   
  @@ -286,11 +289,11 @@
        */
       public void recycle() {
           if (this.generator != null) {
  -            programGenerator.release(this.generator);
  +            this.programGenerator.release(this.generator);
               this.generator = null;
           }
           if (this.inputSource != null) {
  -            this.resolver.release( this.inputSource );
  +            this.resolver.release(this.inputSource);
               this.inputSource = null;
           }
           if (this.completionPipe != null) {
  @@ -304,8 +307,9 @@
        * dispose
        */
       public void dispose() {
  -        manager.release(this.programGenerator);
  +        this.manager.release(this.programGenerator);
           this.programGenerator = null;
  +        this.manager = null;
       }
   
       /* Completion pipe */
  
  
  

Mime
View raw message