sigh I figured it out eventually. I have this loop in the method that writes to the spreadsheet.
while (it.hasNext() == true) {
Map.Entry pairs = (Map.Entry)it.next();
odt.getTableList().get(0).getCellByPosition("A" + i).setDisplayText((String) pairs.getKey()) ;
odt.getTableList().get(0).getCellByPosition("B" + i).setDisplayText((pairs.getValue().toString())) ;
it.remove(); // avoids a ConcurrentModificationException
i++ ;
}
The line it.remove()
("it" is an Iterator variable) is a fatal error...an unfortunate remnant from a copy-paste when I looked up stuff in the past about how to use iterators... :/ Indeed it was the cause of this horrid "only works once" kind of bug. Guess I just really need to make sure I'm not using something wrong or unnecessary when I paste snippets of someone else's code into my work...