cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: rev 36537 - in cocoon/branches/BRANCH_2_1_X/src/blocks: forms/java/org/apache/cocoon/forms forms/java/org/apache/cocoon/forms/binding forms/java/org/apache/cocoon/forms/datatype/validationruleimpl forms/java/org/apache/cocoon/forms/formmodel woody/java/org/apache/cocoon/woody woody/java/org/apache/cocoon/woody/binding woody/java/org/apache/cocoon/woody/datatype/validationruleimpl woody/java/org/apache/cocoon/woody/formmodel
Date Tue, 17 Aug 2004 20:36:47 GMT
Author: vgritsenko
Date: Tue Aug 17 13:36:47 2004
New Revision: 36537

Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/DefaultFormManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/binding/JXPathBindingManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidgetDefinitionBuilder.java
Log:
Fixing component leak


Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/DefaultFormManager.java
Tue Aug 17 13:36:47 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,22 +40,22 @@
 
 /**
  * Component implementing the {@link FormManager} role.
- * 
- * @version $Id: DefaultFormManager.java,v 1.4 2004/03/18 13:56:09 bruno Exp $
+ *
+ * @version $Id$
  */
-public class DefaultFormManager 
-  extends AbstractLogEnabled 
+public class DefaultFormManager
+  extends AbstractLogEnabled
   implements FormManager, ThreadSafe, Serviceable, Disposable, Configurable, Component, Initializable
{
-      
+
     protected static final String PREFIX = "CocoonForm:";
     protected ServiceManager manager;
     protected Configuration configuration;
     protected SimpleServiceSelector widgetDefinitionBuilderSelector;
     protected CacheManager cacheManager;
 
-    public void service(ServiceManager serviceManager) throws ServiceException {
-        this.manager = serviceManager;
-        this.cacheManager = (CacheManager)serviceManager.lookup(CacheManager.ROLE);
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+        this.cacheManager = (CacheManager)manager.lookup(CacheManager.ROLE);
     }
 
     /**
@@ -138,8 +138,12 @@
      * Disposable
      */
     public void dispose() {
-        widgetDefinitionBuilderSelector.dispose();
-        this.manager = null;
+        if (this.widgetDefinitionBuilderSelector != null) {
+            this.widgetDefinitionBuilderSelector.dispose();
+            this.widgetDefinitionBuilderSelector = null;
+        }
+        this.manager.release(this.cacheManager);
         this.cacheManager = null;
+        this.manager = null;
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
Tue Aug 17 13:36:47 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,8 +38,8 @@
  * JXPathBindingManager provides an implementation of {@link BindingManager}by
  * usage of the <a href="http://jakarta.apache.org/commons/jxpath/index.html">
  * JXPath package </a>.
- * 
- * @version CVS $Id: JXPathBindingManager.java,v 1.2 2004/03/11 02:56:32 joerg Exp $
+ *
+ * @version CVS $Id$
  */
 public class JXPathBindingManager extends AbstractLogEnabled implements
         BindingManager, Serviceable, Disposable, Initializable, Configurable,
@@ -47,7 +47,7 @@
 
     private static final String PREFIX = "CocoonFormBinding:";
 
-    private ServiceManager serviceManager;
+    private ServiceManager manager;
 
     private DatatypeManager datatypeManager;
 
@@ -58,21 +58,19 @@
     private CacheManager cacheManager;
 
     public void service(ServiceManager serviceManager) throws ServiceException {
-        this.serviceManager = serviceManager;
-        this.datatypeManager = (DatatypeManager) serviceManager
-                .lookup(DatatypeManager.ROLE);
-        this.cacheManager = (CacheManager) serviceManager
-                .lookup(CacheManager.ROLE);
+        this.manager = serviceManager;
+        this.datatypeManager = (DatatypeManager) serviceManager.lookup(DatatypeManager.ROLE);
+        this.cacheManager = (CacheManager) serviceManager.lookup(CacheManager.ROLE);
     }
 
     public void configure(Configuration configuration)
-            throws ConfigurationException {
+    throws ConfigurationException {
         this.configuration = configuration;
     }
 
     public void initialize() throws Exception {
         bindingBuilderSelector = new SimpleServiceSelector("binding",
-                JXPathBindingBuilderBase.class);
+                                                           JXPathBindingBuilderBase.class);
         bindingBuilderSelector.enableLogging(getLogger());
         bindingBuilderSelector.configure(configuration.getChild("bindings"));
     }
@@ -91,24 +89,24 @@
                             .getBindingForConfigurationElement(rootElm);
                     ((JXPathBindingBase) binding).enableLogging(getLogger());
                     if (getLogger().isDebugEnabled()) {
-                        getLogger().debug(
-                                "Creation of new Binding finished. " + binding);
+                        getLogger().debug("Creation of new Binding finished. " +
+                                          binding);
                     }
                 } else {
                     if (getLogger().isDebugEnabled()) {
-                        getLogger()
-                                .debug(
-                                        "Root Element of said binding file is in wrong namespace.");
+                        getLogger().debug("Root Element of said binding file is in wrong
namespace.");
                     }
                 }
+
                 this.cacheManager.set(binding, source, PREFIX);
             } catch (BindingException e) {
                 throw e;
             } catch (Exception e) {
-                throw new BindingException("Error creating binding from "
-                        + source.getURI(), e);
+                throw new BindingException("Error creating binding from " +
+                                           source.getURI(), e);
             }
         }
+
         return binding;
     }
 
@@ -117,17 +115,21 @@
     }
 
     public void dispose() {
-        this.bindingBuilderSelector.dispose();
-        this.bindingBuilderSelector = null;
-        this.serviceManager.release(this.datatypeManager);
+        if (this.bindingBuilderSelector != null) {
+            this.bindingBuilderSelector.dispose();
+            this.bindingBuilderSelector = null;
+        }
+        this.manager.release(this.datatypeManager);
         this.datatypeManager = null;
+        this.manager.release(this.cacheManager);
         this.cacheManager = null;
+        this.manager = null;
     }
 
     /**
      * Assistant Inner class discloses enough features to the created
      * childBindings to recursively
-     * 
+     *
      * This patterns was chosen to prevent Inversion Of Control between this
      * factory and its builder classes (that could be provided by third
      * parties.)
@@ -189,7 +191,7 @@
         }
 
         public ServiceManager getServiceManager() {
-            return serviceManager;
+            return manager;
         }
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
Tue Aug 17 13:36:47 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,8 +31,8 @@
 
 /**
  * Abstract base class for ValidationRuleBuilder implementations.
- * 
- * @version $Id: AbstractValidationRuleBuilder.java,v 1.2 2004/03/09 13:08:47 cziegeler Exp
$
+ *
+ * @version $Id$
  */
 public abstract class AbstractValidationRuleBuilder implements ValidationRuleBuilder, Serviceable,
Disposable {
     protected ExpressionManager expressionManager;
@@ -40,7 +40,7 @@
 
     public void service(ServiceManager serviceManager) throws ServiceException {
         this.serviceManager = serviceManager;
-        expressionManager = (ExpressionManager)serviceManager.lookup(ExpressionManager.ROLE);
+        this.expressionManager = (ExpressionManager)serviceManager.lookup(ExpressionManager.ROLE);
     }
 
     /**
@@ -69,6 +69,8 @@
     }
 
     public void dispose() {
-        serviceManager.release(expressionManager);
+        this.serviceManager.release(this.expressionManager);
+        this.expressionManager = null;
+        this.serviceManager = null;
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java
Tue Aug 17 13:36:47 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +43,7 @@
  * Abstract base class for WidgetDefinitionBuilders. Provides functionality
  * common to many implementations.
  *
- * @version $Id: AbstractWidgetDefinitionBuilder.java,v 1.3 2004/04/27 12:02:13 bruno Exp
$
+ * @version $Id$
  */
 public abstract class AbstractWidgetDefinitionBuilder implements WidgetDefinitionBuilder,
Serviceable, Disposable {
     protected ServiceSelector widgetDefinitionBuilderSelector;
@@ -55,11 +55,11 @@
 
     public void service(ServiceManager serviceManager) throws ServiceException {
         this.serviceManager = serviceManager;
-        this.widgetDefinitionBuilderSelector = (ServiceSelector)serviceManager.lookup( WidgetDefinitionBuilder.class.getName()
+ "Selector");
-        this.datatypeManager = (DatatypeManager)serviceManager.lookup(DatatypeManager.ROLE);
-        this.expressionManager = (ExpressionManager)serviceManager.lookup(ExpressionManager.ROLE);
-        this.widgetValidatorBuilderSelector = (ServiceSelector)serviceManager.lookup(WidgetValidatorBuilder.ROLE
+ "Selector");
-        this.widgetListenerBuilderSelector = (ServiceSelector)serviceManager.lookup(WidgetListenerBuilder.ROLE
+ "Selector");
+        this.widgetDefinitionBuilderSelector = (ServiceSelector) serviceManager.lookup(WidgetDefinitionBuilder.class.getName()
+ "Selector");
+        this.datatypeManager = (DatatypeManager) serviceManager.lookup(DatatypeManager.ROLE);
+        this.expressionManager = (ExpressionManager) serviceManager.lookup(ExpressionManager.ROLE);
+        this.widgetValidatorBuilderSelector = (ServiceSelector) serviceManager.lookup(WidgetValidatorBuilder.ROLE
+ "Selector");
+        this.widgetListenerBuilderSelector = (ServiceSelector) serviceManager.lookup(WidgetListenerBuilder.ROLE
+ "Selector");
     }
 
     protected void setLocation(Element widgetElement, AbstractWidgetDefinition widgetDefinition)
{
@@ -155,9 +155,14 @@
     }
 
     public void dispose() {
-        serviceManager.release(widgetDefinitionBuilderSelector);
-        serviceManager.release(datatypeManager);
-        serviceManager.release(expressionManager);
-        serviceManager.release(widgetValidatorBuilderSelector);
+        this.serviceManager.release(this.widgetDefinitionBuilderSelector);
+        this.widgetDefinitionBuilderSelector = null;
+        this.serviceManager.release(this.datatypeManager);
+        this.datatypeManager = null;
+        this.serviceManager.release(this.expressionManager);
+        this.expressionManager = null;
+        this.serviceManager.release(this.widgetValidatorBuilderSelector);
+        this.widgetValidatorBuilderSelector = null;
+        this.serviceManager = null;
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/DefaultFormManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/DefaultFormManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/DefaultFormManager.java
Tue Aug 17 13:36:47 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,13 +40,13 @@
 
 /**
  * Component implementing the {@link FormManager} role.
- * 
- * @version $Id: DefaultFormManager.java,v 1.18 2004/03/09 13:54:25 reinhard Exp $
+ *
+ * @version $Id$
  */
-public class DefaultFormManager 
-  extends AbstractLogEnabled 
+public class DefaultFormManager
+  extends AbstractLogEnabled
   implements FormManager, ThreadSafe, Serviceable, Disposable, Configurable, Component, Initializable
{
-      
+
     protected static final String PREFIX = "WoodyForm:";
     protected ServiceManager manager;
     protected Configuration configuration;
@@ -105,9 +105,9 @@
                 InputSource inputSource = new InputSource(source.getInputStream());
                 inputSource.setSystemId(source.getURI());
                 formDocument = DomHelper.parse(inputSource);
-            }
-            catch (Exception exc) {
-                throw new CascadingException("Could not parse form definition from " + source.getURI(),
exc);
+            } catch (Exception e) {
+                throw new CascadingException("Could not parse form definition from " +
+                                             source.getURI(), e);
             }
 
             Element formElement = formDocument.getDocumentElement();
@@ -127,8 +127,12 @@
      * Disposable
      */
     public void dispose() {
-        widgetDefinitionBuilderSelector.dispose();
-        this.manager = null;
+        if (this.widgetDefinitionBuilderSelector != null) {
+            this.widgetDefinitionBuilderSelector.dispose();
+            this.widgetDefinitionBuilderSelector = null;
+        }
+        this.manager.release(this.cacheManager);
         this.cacheManager = null;
+        this.manager = null;
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/binding/JXPathBindingManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/binding/JXPathBindingManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/binding/JXPathBindingManager.java
Tue Aug 17 13:36:47 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,8 +38,8 @@
  * JXPathBindingManager provides an implementation of {@link BindingManager}by
  * usage of the <a href="http://jakarta.apache.org/commons/jxpath/index.html">
  * JXPath package </a>.
- * 
- * @version CVS $Id: JXPathBindingManager.java,v 1.24 2004/03/09 13:54:06 reinhard Exp $
+ *
+ * @version CVS $Id$
  */
 public class JXPathBindingManager extends AbstractLogEnabled implements
         BindingManager, Serviceable, Disposable, Initializable, Configurable,
@@ -47,7 +47,7 @@
 
     private static final String PREFIX = "WoodyBinding:";
 
-    private ServiceManager serviceManager;
+    private ServiceManager manager;
 
     private DatatypeManager datatypeManager;
 
@@ -57,22 +57,20 @@
 
     private CacheManager cacheManager;
 
-    public void service(ServiceManager serviceManager) throws ServiceException {
-        this.serviceManager = serviceManager;
-        this.datatypeManager = (DatatypeManager) serviceManager
-                .lookup(DatatypeManager.ROLE);
-        this.cacheManager = (CacheManager) serviceManager
-                .lookup(CacheManager.ROLE);
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+        this.datatypeManager = (DatatypeManager) manager.lookup(DatatypeManager.ROLE);
+        this.cacheManager = (CacheManager) manager.lookup(CacheManager.ROLE);
     }
 
     public void configure(Configuration configuration)
-            throws ConfigurationException {
+    throws ConfigurationException {
         this.configuration = configuration;
     }
 
     public void initialize() throws Exception {
         bindingBuilderSelector = new SimpleServiceSelector("binding",
-                JXPathBindingBuilderBase.class);
+                                                           JXPathBindingBuilderBase.class);
         bindingBuilderSelector.enableLogging(getLogger());
         bindingBuilderSelector.configure(configuration.getChild("bindings"));
     }
@@ -91,24 +89,24 @@
                             .getBindingForConfigurationElement(rootElm);
                     ((JXPathBindingBase) binding).enableLogging(getLogger());
                     if (getLogger().isDebugEnabled()) {
-                        getLogger().debug(
-                                "Creation of new Binding finished. " + binding);
+                        getLogger().debug("Creation of new Binding finished. " +
+                                          binding);
                     }
                 } else {
                     if (getLogger().isDebugEnabled()) {
-                        getLogger()
-                                .debug(
-                                        "Root Element of said binding file is in wrong namespace.");
+                        getLogger().debug("Root Element of said binding file is in wrong
namespace.");
                     }
                 }
+
                 this.cacheManager.set(binding, source, PREFIX);
             } catch (BindingException e) {
                 throw e;
             } catch (Exception e) {
-                throw new BindingException("Error creating binding from "
-                        + source.getURI(), e);
+                throw new BindingException("Error creating binding from " +
+                                           source.getURI(), e);
             }
         }
+
         return binding;
     }
 
@@ -117,17 +115,21 @@
     }
 
     public void dispose() {
-        this.bindingBuilderSelector.dispose();
-        this.bindingBuilderSelector = null;
-        this.serviceManager.release(this.datatypeManager);
+        if (this.bindingBuilderSelector != null) {
+            this.bindingBuilderSelector.dispose();
+            this.bindingBuilderSelector = null;
+        }
+        this.manager.release(this.datatypeManager);
         this.datatypeManager = null;
+        this.manager.release(this.cacheManager);
         this.cacheManager = null;
+        this.manager = null;
     }
 
     /**
      * Assistant Inner class discloses enough features to the created
      * childBindings to recursively
-     * 
+     *
      * This patterns was chosen to prevent Inversion Of Control between this
      * factory and its builder classes (that could be provided by third
      * parties.)
@@ -189,7 +191,7 @@
         }
 
         public ServiceManager getServiceManager() {
-            return serviceManager;
+            return manager;
         }
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
Tue Aug 17 13:36:47 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,8 +31,8 @@
 
 /**
  * Abstract base class for ValidationRuleBuilder implementations.
- * 
- * @version $Id: AbstractValidationRuleBuilder.java,v 1.7 2004/03/09 13:53:47 reinhard Exp
$
+ *
+ * @version $Id$
  */
 public abstract class AbstractValidationRuleBuilder implements ValidationRuleBuilder, Serviceable,
Disposable {
     protected ExpressionManager expressionManager;
@@ -40,7 +40,7 @@
 
     public void service(ServiceManager serviceManager) throws ServiceException {
         this.serviceManager = serviceManager;
-        expressionManager = (ExpressionManager)serviceManager.lookup(ExpressionManager.ROLE);
+        this.expressionManager = (ExpressionManager)serviceManager.lookup(ExpressionManager.ROLE);
     }
 
     /**
@@ -69,6 +69,8 @@
     }
 
     public void dispose() {
-        serviceManager.release(expressionManager);
+        this.serviceManager.release(this.expressionManager);
+        this.expressionManager = null;
+        this.serviceManager = null;
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidgetDefinitionBuilder.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidgetDefinitionBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractWidgetDefinitionBuilder.java
Tue Aug 17 13:36:47 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +43,7 @@
  * Abstract base class for WidgetDefinitionBuilders. Provides functionality
  * common to many implementations.
  *
- * @version $Id: AbstractWidgetDefinitionBuilder.java,v 1.15 2004/03/09 13:53:56 reinhard
Exp $
+ * @version $Id$
  */
 public abstract class AbstractWidgetDefinitionBuilder implements WidgetDefinitionBuilder,
Serviceable, Disposable {
     protected ServiceSelector widgetDefinitionBuilderSelector;
@@ -54,10 +54,10 @@
 
     public void service(ServiceManager serviceManager) throws ServiceException {
         this.serviceManager = serviceManager;
-        this.widgetDefinitionBuilderSelector = (ServiceSelector)serviceManager.lookup( WidgetDefinitionBuilder.class.getName()
+ "Selector");
-        this.datatypeManager = (DatatypeManager)serviceManager.lookup(DatatypeManager.ROLE);
-        this.expressionManager = (ExpressionManager)serviceManager.lookup(ExpressionManager.ROLE);
-        this.widgetValidatorBuilderSelector = (ServiceSelector)serviceManager.lookup(WidgetValidatorBuilder.ROLE
+ "Selector");
+        this.widgetDefinitionBuilderSelector = (ServiceSelector) serviceManager.lookup(WidgetDefinitionBuilder.class.getName()
+ "Selector");
+        this.datatypeManager = (DatatypeManager) serviceManager.lookup(DatatypeManager.ROLE);
+        this.expressionManager = (ExpressionManager) serviceManager.lookup(ExpressionManager.ROLE);
+        this.widgetValidatorBuilderSelector = (ServiceSelector) serviceManager.lookup(WidgetValidatorBuilder.ROLE
+ "Selector");
     }
 
     protected void setLocation(Element widgetElement, AbstractWidgetDefinition widgetDefinition)
{
@@ -143,9 +143,14 @@
     }
 
     public void dispose() {
-        serviceManager.release(widgetDefinitionBuilderSelector);
-        serviceManager.release(datatypeManager);
-        serviceManager.release(expressionManager);
-        serviceManager.release(widgetValidatorBuilderSelector);
+        this.serviceManager.release(this.widgetDefinitionBuilderSelector);
+        this.widgetDefinitionBuilderSelector = null;
+        this.serviceManager.release(this.datatypeManager);
+        this.datatypeManager = null;
+        this.serviceManager.release(this.expressionManager);
+        this.expressionManager = null;
+        this.serviceManager.release(this.widgetValidatorBuilderSelector);
+        this.widgetValidatorBuilderSelector = null;
+        this.serviceManager = null;
     }
 }

Mime
View raw message