My bad. Just fixed this

On 4 September 2012 10:49, Vincent Hennebert <vhenneb...@gmail.com> wrote:

> On 03/09/12 09:38, mehdi wrote:
> > Author: mehdi
> > Date: Mon Sep  3 08:38:26 2012
> > New Revision: 1380169
> >
> > URL: http://svn.apache.org/viewvc?rev=1380169&view=rev
> > Log:
> > Amended a couple javadocs and some trivial clean up
> >
> > Modified:
> >
> xmlgraphics/fop/trunk/src/java/org/apache/fop/events/CompositeEventListener.java
> >     xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFEncoding.java
> >
> > Modified:
> xmlgraphics/fop/trunk/src/java/org/apache/fop/events/CompositeEventListener.java
> > URL:
> http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/events/CompositeEventListener.java?rev=1380169&r1=1380168&r2=1380169&view=diff
> >
> ==============================================================================
> > ---
> xmlgraphics/fop/trunk/src/java/org/apache/fop/events/CompositeEventListener.java
> (original)
> > +++
> xmlgraphics/fop/trunk/src/java/org/apache/fop/events/CompositeEventListener.java
> Mon Sep  3 08:38:26 2012
> > @@ -19,6 +19,7 @@
> >
> >  package org.apache.fop.events;
> >
> > +import java.util.ArrayList;
> >  import java.util.List;
> >
> >  /**
> > @@ -26,7 +27,7 @@ import java.util.List;
> >   */
> >  public class CompositeEventListener implements EventListener {
> >
> > -    private List listeners = new java.util.ArrayList();
> > +    private List<EventListener> listeners = new
> ArrayList<EventListener>();
> >
> >      /**
> >       * Adds an event listener to the broadcaster. It is appended to the
> list of previously
> > @@ -46,22 +47,17 @@ public class CompositeEventListener impl
> >          this.listeners.remove(listener);
> >      }
> >
> > -    private synchronized int getListenerCount() {
> > -        return this.listeners.size();
> > -    }
> > -
> >      /**
> >       * Indicates whether any listeners have been registered with the
> broadcaster.
> >       * @return true if listeners are present, false otherwise
> >       */
> >      public boolean hasEventListeners() {
> > -        return (getListenerCount() > 0);
> > +        return !listeners.isEmpty();
> >      }
>
> By calling getListenerCount this method was made thread-safe. Now it no
> longer is. Is that really intended?
>
> >
> > -    /** {@inheritDoc} */
> > +    /** {@inheritDoc } */
>
> Spurious change here.
>
>
> >      public synchronized void processEvent(Event event) {
> > -        for (int i = 0, c = getListenerCount(); i < c; i++) {
> > -            EventListener listener =
> (EventListener)this.listeners.get(i);
> > +        for (EventListener listener : listeners) {
> >              listener.processEvent(event);
> >          }
> >      }
>
> Thanks,
> Vincent
>

Reply via email to