bloritsch    01/02/26 09:41:56

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
  Log:
  Make sure Parser is released when done.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.60  +6 -3      xml-cocoon/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.4.2.59
  retrieving revision 1.4.2.60
  diff -u -r1.4.2.59 -r1.4.2.60
  --- Cocoon.java       2001/02/24 15:58:04     1.4.2.59
  +++ Cocoon.java       2001/02/26 17:41:48     1.4.2.60
  @@ -49,7 +49,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a> 
(Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.4.2.59 $ $Date: 2001/02/24 15:58:04 $
  + * @version CVS $Revision: 1.4.2.60 $ $Date: 2001/02/26 17:41:48 $
    */
   public class Cocoon extends AbstractLoggable implements Component, 
Initializable, Modifiable, Processor, Contextualizable {
       /** The application context */
  @@ -133,18 +133,21 @@
   
       /** Configure this <code>Cocoon</code> instance. */
       public void configure() throws ConfigurationException {
  +        Parser p = null;
  +
           try {
  -            Parser p = (Parser)this.componentManager.lookup(Roles.PARSER);
  +            p = (Parser)this.componentManager.lookup(Roles.PARSER);
               SAXConfigurationHandler b = new SAXConfigurationHandler();
               InputSource is = new 
InputSource(this.configurationFile.openStream());
               p.setContentHandler(b);
               is.setSystemId(this.configurationFile.toExternalForm());
               p.parse(is);
               this.configuration = b.getConfiguration();
  -            this.componentManager.release((Component) p);
           } catch (Exception e) {
               getLogger().error("Could not configure Cocoon environment", e);
               throw new ConfigurationException("Error trying to load 
configurations");
  +        } finally {
  +            if (p != null) this.componentManager.release((Component) p);
           }
   
           Configuration conf = this.configuration;
  
  
  

Reply via email to