protected void forceInitializationAndClean(List<HistoryComment> comments) {
if (comments!=null) {
comments.size();
List<HistoryComment> copy = new ArrayList<HistoryComment>(comments);
for (int i=0; i<copy.size(); i++) {
HistoryComment comment = copy.get(i);
// when comments get deleted, it's possible that we
// get null values in the list as the indexes of the
// other comments are not upated.
// So if there is a null value, we can safely delete it
// from the persistent list and cause the indexes to
// be updated
if (comment==null) {
comments.remove(i);
} else {
forceInitializationAndClean(comment.getReplies());
}
}
}
}