History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: SES-645
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Arjohn Kampman
Reporter: Nick Giles
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Sesame

OrderIterator doesn't check if it has been closed during operation (i.e. timed out)

Created: 26/Nov/08 04:06 PM   Updated: 17/Dec/08 02:04 PM
Component/s: None
Affects Version/s: 2.2.1
Fix Version/s: 2.2.2


 Description   
The OrderIterator pulls all the results from its wrapped iteration into a list, then sorts it. However, whilst in this extract loop it doesn't check for close, so a timeout call is not respected. Adding checks into the loop, and for the sort immediately after would be useful, e.g.:

    private Iterator<BindingSet> getOrderedIterator()
            throws QueryEvaluationException {
        if (ordered == null) {
            List<BindingSet> list = new ArrayList<BindingSet>(1024);
            while (!isClosed() && iter.hasNext()) {
                list.add(iter.next());
            }
            if(!isClosed()) {
                Collections.sort(list, comparator);
            }
            ordered = list.iterator();
        }
        return ordered;
    }


 All   Comments   Change History      Sort Order:
Comment by Nick Giles [26/Nov/08 05:17 PM]
Actually, closing the underlying iteration may be more consistent with the approach elsewhere. It would still be useful to avoid performing the sort if the iteration has been closed though, since it can be a costly operation.

Comment by Arjohn Kampman [01/Dec/08 05:10 PM]
The result ordering code has been cleaned up and an isClosed() check has been added before starting the actual sorting.