You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Vadim Gritsenko <vg...@hns.com> on 2001/06/20 18:09:46 UTC

[PATCH][EXCALIBUR] ComponentManager.release() have bug?

Hello,

I think I found something which looks like bug in Excalibur code,
in ExcaliburComponentManager. This was hard to track down, but here it is...

In lookup(), if handler is not there it goes to parent component manager.
But in release(), it does not releases components to parent. Is it a bug or not?

Code snippet:
--------------------------------
    public void release(Component component)
    {
        if(null == component)
            return;
        ComponentHandler handler = (ComponentHandler)m_componentMapping.get(component);

        if(null != handler){
            try{
                handler.put(component);
            }catch(Exception e){
                getLogger().debug("Error trying to release component.", e);
            }
            m_componentMapping.remove(component);
        }
    }
--------------------------------
Suggested fix:
--------------------------------
    public void release(Component component)
    {
        if(null == component)
            return;
        ComponentHandler handler = (ComponentHandler)m_componentMapping.get(component);

        if(null != handler){
            try{
                handler.put(component);
            }catch(Exception e){
                getLogger().debug("Error trying to release component.", e);
            }
            m_componentMapping.remove(component);
        }else if(m_parentManager != null){
           	m_parentManager.release(component);
        }
    }
--------------------------------

Thanks,
Vadim

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [PATCH][EXCALIBUR] ComponentManager.release() have bug?

Posted by giacomo <gi...@apache.org>.
On Wed, 20 Jun 2001, Berin Loritsch wrote:

talking about bugs in Avalon :)

I've added a patch which makes the excaliburs
DefaultComponentPoolController a Component because I've got a
ClassCastException somewhere in a ComponentHolder.

Giacomo

Index: DefaultComponentPoolController.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon/src/java/org/apache/avalon/excalibur/component/DefaultComponentPoolController.java,v
retrieving revision 1.4
diff -u -r1.4 DefaultComponentPoolController.java
--- DefaultComponentPoolController.java 2001/06/01 21:09:18     1.4
+++ DefaultComponentPoolController.java 2001/06/20 19:39:33
@@ -8,6 +8,7 @@
 package org.apache.avalon.excalibur.component;

 import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.avalon.framework.component.Component;
 import org.apache.avalon.excalibur.pool.PoolController;

 /**
@@ -19,7 +20,7 @@
  * @version CVS $Revision: 1.4 $ $Date: 2001/06/01 21:09:18 $
  */
 public class DefaultComponentPoolController
-    implements PoolController, ThreadSafe
+    implements Component, PoolController, ThreadSafe
 {
     /** Default increase/decrease amount */
     public static final int  DEFAULT_AMOUNT      = 8;



> Vadim Gritsenko wrote:
> >
> > Hello,
> >
> > I think I found something which looks like bug in Excalibur code,
> > in ExcaliburComponentManager. This was hard to track down, but here it is...
> >
> > In lookup(), if handler is not there it goes to parent component manager.
> > But in release(), it does not releases components to parent. Is it a bug or not?
>
> This is a bug.  Thank you for finding it.  I have patched the Avalon source code.
>
> >
> > Code snippet:
> > --------------------------------
> >     public void release(Component component)
> >     {
> >         if(null == component)
> >             return;
> >         ComponentHandler handler = (ComponentHandler)m_componentMapping.get(component);
> >
> >         if(null != handler){
> >             try{
> >                 handler.put(component);
> >             }catch(Exception e){
> >                 getLogger().debug("Error trying to release component.", e);
> >             }
> >             m_componentMapping.remove(component);
> >         }
> >     }
> > --------------------------------
> > Suggested fix:
> > --------------------------------
> >     public void release(Component component)
> >     {
> >         if(null == component)
> >             return;
> >         ComponentHandler handler = (ComponentHandler)m_componentMapping.get(component);
> >
> >         if(null != handler){
> >             try{
> >                 handler.put(component);
> >             }catch(Exception e){
> >                 getLogger().debug("Error trying to release component.", e);
> >             }
> >             m_componentMapping.remove(component);
> >         }else if(m_parentManager != null){
> >                 m_parentManager.release(component);
> >         }
> >     }
> > --------------------------------
> >
> > Thanks,
> > Vadim
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [PATCH][EXCALIBUR] ComponentManager.release() have bug?

Posted by Berin Loritsch <bl...@apache.org>.
Vadim Gritsenko wrote:
> 
> Hello,
> 
> I think I found something which looks like bug in Excalibur code,
> in ExcaliburComponentManager. This was hard to track down, but here it is...
> 
> In lookup(), if handler is not there it goes to parent component manager.
> But in release(), it does not releases components to parent. Is it a bug or not?

This is a bug.  Thank you for finding it.  I have patched the Avalon source code.

> 
> Code snippet:
> --------------------------------
>     public void release(Component component)
>     {
>         if(null == component)
>             return;
>         ComponentHandler handler = (ComponentHandler)m_componentMapping.get(component);
> 
>         if(null != handler){
>             try{
>                 handler.put(component);
>             }catch(Exception e){
>                 getLogger().debug("Error trying to release component.", e);
>             }
>             m_componentMapping.remove(component);
>         }
>     }
> --------------------------------
> Suggested fix:
> --------------------------------
>     public void release(Component component)
>     {
>         if(null == component)
>             return;
>         ComponentHandler handler = (ComponentHandler)m_componentMapping.get(component);
> 
>         if(null != handler){
>             try{
>                 handler.put(component);
>             }catch(Exception e){
>                 getLogger().debug("Error trying to release component.", e);
>             }
>             m_componentMapping.remove(component);
>         }else if(m_parentManager != null){
>                 m_parentManager.release(component);
>         }
>     }
> --------------------------------
> 
> Thanks,
> Vadim
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org