Jeremy,

Could you put these (this and the ResourceImpl suggestion) on JIRA as patches?

        thanks,
        Andy

https://issues.apache.org/jira/browse/JENA

On 16/08/12 06:40, Jeremy Carroll wrote:

(From Jena 2.7.2)

I suggest replacing:

  /**
          Answer the concatenation of all the iterators from
a-subGraph.find( t ).
     */
     private ExtendedIterator<Triple> multiGraphFind( final TripleMatch t )
         {
         Set<Triple> seen = CollectionFactory.createHashedSet();
         ExtendedIterator<Triple> result = NullIterator.instance();
         for (Iterator<Graph> graphs = m_subGraphs.iterator();
graphs.hasNext(); )
             {
             ExtendedIterator<Triple> newTriples = recording( rejecting(
graphs.next().find( t ), seen ), seen );
             result = result.andThen( newTriples );
             }
         return result;
         }


With:

/**
          Answer the concatenation of all the iterators from
a-subGraph.find( t ).
      */
     private ExtendedIterator<Triple> multiGraphFind( final TripleMatch t )
     {
         Set<Triple> seen = CollectionFactory.createHashedSet();
         ExtendedIterator<Triple> result = NullIterator.instance();
         boolean finished = false;
         try {
             for (Iterator<Graph> graphs = m_subGraphs.iterator();
graphs.hasNext(); )
             {
                 ExtendedIterator<Triple> newTriples = recording(
rejecting( graphs.next().find( t ), seen ), seen );
                 result = result.andThen( newTriples );
             }
             finished = true;
             return result;
         }
         finally {
             if (!finished) {
                 result.close();
             }

         }
     }


I have had the case that an exception in the 2nd or 3rd
graphs.next().find(t) then leaves 1st iterator open.

Jeremy

Reply via email to