jakarta-jcs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Rall <...@collab.net>
Subject Re: [PATCH] ElementAttributes.copy()
Date Thu, 22 Apr 2004 00:23:10 GMT
Mike Pettypiece wrote:
> Hello All,
>  
> I was attempting to create an implementation of IElementEventHandler and
> I noticed that events are currently not being sent properly.  I tracked
> down the problem to the copy() method of ElementAttributes where the
> event handlers are not being copied.
>  
> Here is a patch which should fix the problem.  Would someone with CVS
> commit privileges please look this over?

Comments inline.

> Index: src/java/org/apache/jcs/engine/ElementAttributes.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/Eleme
> ntAttributes.java,v
> retrieving revision 1.5
> diff -u -r1.5 ElementAttributes.java
> --- src/java/org/apache/jcs/engine/ElementAttributes.java 15 Apr 2004
> 19:22:49 -0000 1.5
> +++ src/java/org/apache/jcs/engine/ElementAttributes.java 20 Apr 2004
> 20:32:02 -0000
> @@ -23,12 +23,11 @@
>  import java.io.ObjectInputStream;
>  import java.io.ObjectOutputStream;
>  import java.io.Serializable;
> -
>  import java.util.ArrayList;
> -
> -import
> org.apache.jcs.engine.control.event.behavior.IElementEventHandler;
> +import java.util.Iterator;
>  
>  import org.apache.jcs.engine.behavior.IElementAttributes;
> +import
> org.apache.jcs.engine.control.event.behavior.IElementEventHandler;
>  
>  /**
>   *  Element attribute descriptor class.
> @@ -163,6 +162,7 @@
>              attr.setIsRemote( this.getIsRemote() );
>              attr.setIsSpool( this.getIsSpool() );
>              attr.setMaxLifeSeconds( this.getMaxLifeSeconds() );
> +            attr.addElementEventHandlers( this.eventHandlers );
>              return attr;
>          }
>          catch ( Exception e )
> @@ -230,6 +230,7 @@
>          this.mls = mls;
>      }
>  
> +
>      /**
>       *  Gets the {3} attribute of the ElementAttributes object
>       *
> @@ -473,6 +474,26 @@
>      }
>  
>      /**
> +     *  Sets the eventHandlers of the IElementAttributes object
> +     *
> +     *@param <mailto:*@param>   eventHandlers  The new {3} value

The above JavaDoc wasn't right from where you copied it, and isn't right here 
either.  ;-)

> +     */
> +    public void addElementEventHandlers( ArrayList eventHandlers )


The parameter's data type should be a Collection, or List if sequence is important.

> +    {
> +        if ( eventHandlers == null )
> +        {
> +            return;
> +        }
> +        
> +        for ( Iterator iter = eventHandlers.iterator(); iter.hasNext();
> )
> +        {
> +            addElementEventHandler( (IElementEventHandler)iter.next()
> );
> +        }
> +    }
> +   
> +
> +    
> +    /**
>       *  Gets the elementEventHandlers. Returns null if none exist.
> Makes
>       *  checking easy.
>       *
> @@ -483,8 +504,7 @@
>      {
>          return this.eventHandlers;
>      }
> -
> -
> +    
>      /**
>       *  For logging and debugging the element IElementAttributes.
>       *
> Index: src/java/org/apache/jcs/engine/behavior/IElementAttributes.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/behav
> ior/IElementAttributes.java,v
> retrieving revision 1.5
> diff -u -r1.5 IElementAttributes.java
> --- src/java/org/apache/jcs/engine/behavior/IElementAttributes.java 15
> Apr 2004 19:22:53 -0000 1.5
> +++ src/java/org/apache/jcs/engine/behavior/IElementAttributes.java 20
> Apr 2004 20:32:02 -0000
> @@ -209,6 +209,13 @@
>       *@param <mailto:*@param>   eventHandler  The feature to be added
> to the ElementEventHandler
>       */
>      public void addElementEventHandler( IElementEventHandler
> eventHandler );
> +    
> +    /**
> +     *  Sets the eventHandlers of the IElementAttributes object
> +     *
> +     *@param <mailto:*@param>   eventHandlers  The new {3} value

Bad JavaDoc.

> +     */
> +    public void addElementEventHandlers( ArrayList eventHandlers );

Same interface comment applies.

>  
>      /**
>       *  Gets the elementEventHandlers.
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-dev-help@jakarta.apache.org


Mime
View raw message