classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Re: imageio/ImageReader|Writer check *Listeners


From: Thomas Fitzsimmons
Subject: Re: [cp-patches] Re: imageio/ImageReader|Writer check *Listeners
Date: Tue, 04 Oct 2005 10:01:35 -0400

On Tue, 2005-10-04 at 07:39 +0200, Andreas Tobler wrote:
> Andreas Tobler wrote:
> > Hi Tom,
> > 
> > Thomas Fitzsimmons wrote:
> > 
> >>> @@ -185,8 +185,10 @@
> >>>   {
> >>>     if (listener == null)
> >>>       return;
> >>> -
> >>> -    progressListeners.add(listener);    +    if (progressListeners 
> >>> != null)
> >>> +      {
> >>> +    progressListeners.add(listener);
> >>> +      }
> >>
> >>
> >>
> >> If progressListeners is null here it should be initialized to a new
> >> ArrayList, otherwise no listener could ever be added.  Otherwise this
> >> patch looks good.
> > 
> > 
> > Ok, but this would apply to all addIIO*Listeners, right? In ImageReader 
> > and ImageWriter. (progressListeners, updateListeners & warningListeners)
> > 
> > Would this be ok? Or should the ArrayList be initialized with the 
> > default 10 elements? new ArrayList()?
> > 
> >   public void addIIOReadProgressListener(IIOReadProgressListener listener)
> >   {
> >     if (listener == null)
> >       return;
> >     if (progressListeners != null)
> >       {
> >     progressListeners.add(listener);
> >       }
> >     else
> >       {
> >     progressListeners = new ArrayList(0);
> >     progressListeners.add(listener);
> >       }
> >   }
> 
> Ok, this one looks shorter.
> 
>    public void addIIOReadProgressListener(IIOReadProgressListener listener)
>    {
>      if (listener == null)
>        return;
>      if (progressListeners == null)
>        progressListeners = new ArrayList ();
>      progressListeners.add(listener);
>    }

I replied to the previous message before seeing this one.  Yes, this way
is shorter/better.  Please commit.

Thanks,
Tom

> 
> ?
> 
> Andreas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]