Ticket #1647 (closed defect: moved)

Opened 7 years ago

Last modified 7 years ago

Table row sizing bug

Reported by: curtis Owned by: curtis
Priority: major Milestone: imagej2-unscheduled
Component: Data Model Version: 2.0.0-beta6
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1713


There is a bug in the Table implementation, as illustrated by the following code:

import imagej.data.table.DefaultGenericTable;
import imagej.data.table.GenericTable;

public class TableBug {

	public static void main(final String[] args) throws Exception {
		final String first = "First";
		final String second = "Second";
		final int rowCount = 10;

		final GenericTable table = new DefaultGenericTable();

		for (int row = 0; row < rowCount; row++) {
			table.set(first, row, "1st:" + row);
			table.set(second, row, "2nd:" + row);


It throws the following exception:

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
	at java.util.ArrayList.set(ArrayList.java:337)
	at imagej.data.table.AbstractTable.set(AbstractTable.java:408)
	at TableBug.main(TableBug.java:18)

But if you move the setRowCount call after the two appendColumn calls, the code works.

Change History

comment:1 Changed 7 years ago by bdezonia

  • Blocking 1713 added

comment:2 Changed 6 years ago by curtis

  • Status changed from new to closed
  • Resolution set to moved
Note: See TracTickets for help on using tickets.