classpath-patches
[Top][All Lists]
Advanced

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

Re: [cp-patches] Complete javax.imageio


From: Thomas Fitzsimmons
Subject: Re: [cp-patches] Complete javax.imageio
Date: Mon, 03 Oct 2005 11:39:25 -0400

On Mon, 2005-10-03 at 16:12 +0200, Andreas Tobler wrote:
> Hi Tom,
> 
> hopefully you can enlight a java newbie :)
> 
> In javax/imageio/ImageReader.java you change the following for example
> 
> protected List progressListeners = new ArrayList();
> 
> to
> 
> protected List progressListeners = null;
> 
> The java doc says:
> 
> progressListeners:
> 
> A List of currently registered IIOReadProgressListeners, initialized by 
> default to null, which is synonymous with an empty List.
> 
> My problem is here:
> 
> protected void processImageComplete()
>    {

We should just wrap a != null check around listener code.

Tom

>      Iterator it = progressListeners.iterator();
> 
> in the same file.
> 
> I get an NPE on this since progressListeners is initialized to null, not 
> to an empty List, to null.
> 
> This prevents me to run the swing Demo in 2D mode.
> 
> I changed the above initializer to:
> 
> protected List progressListeners = new ArrayList(0);
> 
> now i can run the demo fine again.
> 
> So, am I missing an initialization of this progressListeners elsewhere? 
> Or is the initializing to null wrong?
> 
> Thanks,
> Andreas
> 
> 





reply via email to

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