Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Help for the Java challenged: how can ArrayIndexOutOfBoundsException be thrown here?

Nathan Ridge wrote:
> 			return fUsingDirectives.toArray(new ICPPUsingDirective[fUsingDirectives.size()]);
> 
> The previous line ensures that fUsingDirectives is not null.
> 
> I don't see how an ArrayIndexOutOfBoundsException can be thrown in this case. (But I also can't see the source of the ArrayList.toArray() method to see what exactly it's trying to do.)

I imagine this could happen if some other thread is concurrently adding items to fUsingDirectives.

 -Christian



Back to the top