if (source == null) {
return ERROR;
} else {
try {
if (!MakeIterator.isIterable(source)) {
LogFactory.getLog(SortIteratorFilter.class.getName()).warn("Cannot create SortIterator for source " + source);
return ERROR;
}
list = new ArrayList();
Iterator i = MakeIterator.convert(source);
while (i.hasNext()) {
list.add(i.next());
}
// Sort it
Collections.sort(list, comparator);
iterator = list.iterator();
return SUCCESS;
} catch (Exception e) {
LogFactory.getLog(SortIteratorFilter.class.getName()).warn("Error creating sort iterator.", e);
return ERROR;
}
}