List rawCols = table.getColumns();
if (rawCols != null) {
int colnum = 1;
ListIterator iter = rawCols.listIterator();
while (iter.hasNext()) {
TableColumn col = (TableColumn)iter.next();
if (col != null) {
colnum = col.getColumnNumber();
}
for (int i = 0; i < col.getNumberColumnsRepeated(); i++) {
while (colnum > columns.size()) {
columns.add(null);
}
columns.set(colnum - 1, col);
colnum++;
}
}
//Post-processing the list (looking for gaps)
int pos = 1;
ListIterator ppIter = columns.listIterator();
while (ppIter.hasNext()) {
TableColumn col = (TableColumn)ppIter.next();
if (col == null) {
log.error("Found a gap in the table-columns at position " + pos);
}
pos++;
}