commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 38565] - [collections] java.lang.ArrayIndexOutOfBoundsException
Date Wed, 08 Feb 2006 15:41:31 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38565>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38565





------- Additional Comments From stijn.christiaens@vub.ac.be  2006-02-08 16:41 -------
This little class recreates the bug. It must have something to do with the
automatic remove (which increases the member attribute start), because if there
is no overflow (and thus automatic remove) the problem does not occur. I hope
this helps.

import java.util.Collection;
import java.util.Iterator;

import org.apache.commons.collections.buffer.CircularFifoBuffer;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Collection<String> breadCrumbs = new CircularFifoBuffer(4);
		breadCrumbs.add("1");
		breadCrumbs.add("2");
		breadCrumbs.add("3");
		breadCrumbs.add("4");
		breadCrumbs.add("5");
		
		String current = "2";

		Iterator<String> iter = breadCrumbs.iterator();
		boolean remove = false;
		while (iter.hasNext()) {
			String temp = iter.next();
			if (remove) {
				iter.remove();
			}
			if (current.equals(temp)) {
				remove = true;
			}
		}
		if (!remove) {
			breadCrumbs.add(current);
		}
		
		iter = breadCrumbs.iterator();
		while (iter.hasNext()) {
			String temp = iter.next();
			System.out.println(temp);
		}		
	}

}


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message