Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-2151

Iter.filter does not close nested iterator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Jena 4.1.0
    • Jena 4.2.0
    • None
    • None

    Description

      We recently attempted to upgrade our product to Jena 4.1.0 but noticed unclosed iterator warnings. I believe I have tracked it down to the fact that Iter.filter does not return a Closeable iterator and therefore does not close its nested (stream) iterator. I am attaching an implementation class that seems to fix it. With this, org.apache.jena.atlas.iterator.Iter.filter simply need to become

          public static <T> Iterator<T> filter(final Iterator<? extends T> stream, final Predicate<T> filter) {
              return new IteratorFilter<T>(stream, filter);
          }
      
      

      (Although Iter.filter hasn't changed for a while, I suspect some other changes to Jena caused the SPARQL engine to use it, and this has broken some scenarios for us - in particular calling SPIN/SHACL-SPARQL functions with BGPs in the WHERE clause).

      Attachments

        1. IteratorFilter.java
          1 kB
          Holger Knublauch

        Issue Links

          Activity

            People

              andy Andy Seaborne
              holgerknublauch Holger Knublauch
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: