Thanks Mauricio
I'll apply the patch and add your test case to the JUnit test cases..
Many thanks
James
----- Original Message -----
From: "MSex" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 11, 2001 10:22 PM
Subject: Colection Bug???
> I found a possible bug in the ArrayIterator class.
>
> The index to the current position in the array
> changes when you call the "hasNext()" function,
> I think it shoud only change when you call the "next()"
> function. (just like the ArrayEnumeration and JDK Iteretor behavior)
>
> I did the following test:
>
> public static void main(String[] args)
> {
> Vector testVector = new Vector();
> testVector.add("teste1");
> testVector.add("teste2");
> testVector.add("teste3");
>
> Iterator itVector = testVector.iterator();
>
>
> System.out.println("With JDK implematation...");
> if (itVector.hasNext())
> {
> System.out.println((String) itVector.next());
> System.out.println((String) itVector.next());
> System.out.println((String) itVector.next());
> }
>
> String[] testArray = {"teste1", "teste2", "teste3"};
>
> ArrayIterator itArray = new ArrayIterator(testArray);
>
> System.out.println(
> "\nWith Jakarta Commons ArrayIterator implematation...");
> if (itArray.hasNext())
> {
> System.out.println((String) itArray.next());
> System.out.println((String) itArray.next());
> System.out.println((String) itArray.next());
> }
> }
>
>
> and the program output was:
>
> "With JDK implematation...
> teste1
> teste2
> teste3
>
> With Jakarta Commons ArrayIterator implematation...
> teste1
> teste1
> teste1"
>
> So I fixed the class and my version of the file is attached.
>
> Thank you,
> Mauricio S. Moura
>
>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com