Uploaded image for project: 'OpenNLP'
  1. OpenNLP
  2. OPENNLP-527

No way to close FileEventStreams

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: maxent-3.0.2-incubating
    • Fix Version/s: tools-1.5.3
    • Component/s: Machine Learning
    • Labels:
      None

      Description

      So I noticed this bug because RealValueFileEventStream.main does not close the EventStream that it opens, leaving a new file open every time it is called.

      I thought I could work around this by inlining the RealValueFileEventStream.main code, but it turns out that RealValueFileEventStream doesn't have a close method so there's nothing you can do. It's superclass, FileEventStream, opens up a FileInputStream, but doesn't expose that in any way.

      So, as far as I can tell, there's no way to close one of these event streams.

      I think the simplest solution would be to add a .close() method to FileEventStream (and have it implement java.io.Closeable). Then RealValueFileEventStream would inherit that method.

        Attachments

        1. FileEventStream.close.patch
          6 kB
          Steven Bethard
        2. FileEventStream.close.patch
          5 kB
          Steven Bethard

          Activity

            People

            • Assignee:
              joern Jörn Kottmann
              Reporter:
              steven.bethard Steven Bethard
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: