You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@opennlp.apache.org by "Steven Bethard (JIRA)" <ji...@apache.org> on 2012/07/24 21:13:35 UTC

[jira] [Created] (OPENNLP-527) No way to close FileEventStreams

Steven Bethard created OPENNLP-527:
--------------------------------------

             Summary: No way to close FileEventStreams
                 Key: OPENNLP-527
                 URL: https://issues.apache.org/jira/browse/OPENNLP-527
             Project: OpenNLP
          Issue Type: Bug
          Components: OpenNLP ML
    Affects Versions: maxent-3.0.2-incubating
            Reporter: Steven Bethard


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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENNLP-527) No way to close FileEventStreams

Posted by "Joern Kottmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENNLP-527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13422548#comment-13422548 ] 

Joern Kottmann commented on OPENNLP-527:
----------------------------------------

Thanks for your patch!
The stream handling should be enclosed with try-finally to ensure that streams get closed also when an exception is thrown.
Can you add this? Then the patch can be applied.

I know the EventStream is not the best part of OpenNLP, because it ignores the fact that there can be exceptions while reading from it. Hopefully we get that fixed with the next bigger release.
                
> No way to close FileEventStreams
> --------------------------------
>
>                 Key: OPENNLP-527
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-527
>             Project: OpenNLP
>          Issue Type: Bug
>          Components: OpenNLP ML
>    Affects Versions: maxent-3.0.2-incubating
>            Reporter: Steven Bethard
>         Attachments: FileEventStream.close.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (OPENNLP-527) No way to close FileEventStreams

Posted by "Joern Kottmann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENNLP-527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joern Kottmann resolved OPENNLP-527.
------------------------------------

       Resolution: Fixed
    Fix Version/s: tools-1.5.3

Thanks for fixing this! Please close the issue if the committed changes work for you.
                
> No way to close FileEventStreams
> --------------------------------
>
>                 Key: OPENNLP-527
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-527
>             Project: OpenNLP
>          Issue Type: Bug
>          Components: Maxent
>    Affects Versions: maxent-3.0.2-incubating
>            Reporter: Steven Bethard
>            Assignee: Joern Kottmann
>             Fix For: tools-1.5.3
>
>         Attachments: FileEventStream.close.patch, FileEventStream.close.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENNLP-527) No way to close FileEventStreams

Posted by "Steven Bethard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENNLP-527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steven Bethard updated OPENNLP-527:
-----------------------------------

    Attachment: FileEventStream.close.patch

Here's a patch that adds FileEventStream.close(). I also tried to add the .close() calls in all the places where it looked like they were needed.
                
> No way to close FileEventStreams
> --------------------------------
>
>                 Key: OPENNLP-527
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-527
>             Project: OpenNLP
>          Issue Type: Bug
>          Components: OpenNLP ML
>    Affects Versions: maxent-3.0.2-incubating
>            Reporter: Steven Bethard
>         Attachments: FileEventStream.close.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (OPENNLP-527) No way to close FileEventStreams

Posted by "Joern Kottmann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENNLP-527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joern Kottmann reassigned OPENNLP-527:
--------------------------------------

    Assignee: Joern Kottmann
    
> No way to close FileEventStreams
> --------------------------------
>
>                 Key: OPENNLP-527
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-527
>             Project: OpenNLP
>          Issue Type: Bug
>          Components: Maxent
>    Affects Versions: maxent-3.0.2-incubating
>            Reporter: Steven Bethard
>            Assignee: Joern Kottmann
>         Attachments: FileEventStream.close.patch, FileEventStream.close.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENNLP-527) No way to close FileEventStreams

Posted by "Joern Kottmann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENNLP-527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joern Kottmann updated OPENNLP-527:
-----------------------------------

    Component/s:     (was: OpenNLP ML)
                 Maxent
    
> No way to close FileEventStreams
> --------------------------------
>
>                 Key: OPENNLP-527
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-527
>             Project: OpenNLP
>          Issue Type: Bug
>          Components: Maxent
>    Affects Versions: maxent-3.0.2-incubating
>            Reporter: Steven Bethard
>         Attachments: FileEventStream.close.patch, FileEventStream.close.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENNLP-527) No way to close FileEventStreams

Posted by "Steven Bethard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENNLP-527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steven Bethard updated OPENNLP-527:
-----------------------------------

    Attachment: FileEventStream.close.patch
    
> No way to close FileEventStreams
> --------------------------------
>
>                 Key: OPENNLP-527
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-527
>             Project: OpenNLP
>          Issue Type: Bug
>          Components: OpenNLP ML
>    Affects Versions: maxent-3.0.2-incubating
>            Reporter: Steven Bethard
>         Attachments: FileEventStream.close.patch, FileEventStream.close.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (OPENNLP-527) No way to close FileEventStreams

Posted by "Steven Bethard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENNLP-527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steven Bethard closed OPENNLP-527.
----------------------------------


Looks good. Thanks for the quick commit.
                
> No way to close FileEventStreams
> --------------------------------
>
>                 Key: OPENNLP-527
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-527
>             Project: OpenNLP
>          Issue Type: Bug
>          Components: Maxent
>    Affects Versions: maxent-3.0.2-incubating
>            Reporter: Steven Bethard
>            Assignee: Joern Kottmann
>             Fix For: tools-1.5.3
>
>         Attachments: FileEventStream.close.patch, FileEventStream.close.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENNLP-527) No way to close FileEventStreams

Posted by "Joern Kottmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENNLP-527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13422630#comment-13422630 ] 

Joern Kottmann commented on OPENNLP-527:
----------------------------------------

The component name here is "Maxent", names are a bit confusing, Maxent is the "old" thing we currently ship, and OpenNLP ML is the planned replacement for it. OpenNLP ML lives in our sandbox and is currently just a fork with some renaming of Maxent.
                
> No way to close FileEventStreams
> --------------------------------
>
>                 Key: OPENNLP-527
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-527
>             Project: OpenNLP
>          Issue Type: Bug
>          Components: Maxent
>    Affects Versions: maxent-3.0.2-incubating
>            Reporter: Steven Bethard
>            Assignee: Joern Kottmann
>         Attachments: FileEventStream.close.patch, FileEventStream.close.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENNLP-527) No way to close FileEventStreams

Posted by "Joern Kottmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENNLP-527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13422635#comment-13422635 ] 

Joern Kottmann commented on OPENNLP-527:
----------------------------------------

BTW, nice to implement the Closeable in FileEventStream, we should probably do that too in our ObjectStream API.
                
> No way to close FileEventStreams
> --------------------------------
>
>                 Key: OPENNLP-527
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-527
>             Project: OpenNLP
>          Issue Type: Bug
>          Components: Maxent
>    Affects Versions: maxent-3.0.2-incubating
>            Reporter: Steven Bethard
>            Assignee: Joern Kottmann
>         Attachments: FileEventStream.close.patch, FileEventStream.close.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENNLP-527) No way to close FileEventStreams

Posted by "Joern Kottmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENNLP-527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13421852#comment-13421852 ] 

Joern Kottmann commented on OPENNLP-527:
----------------------------------------

Thanks for pointing this out. The one who opens the stream is responsible to close it. So in this case that obviously should happen in our code.

Do you mind to attach a patch to fix it?
                
> No way to close FileEventStreams
> --------------------------------
>
>                 Key: OPENNLP-527
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-527
>             Project: OpenNLP
>          Issue Type: Bug
>          Components: OpenNLP ML
>    Affects Versions: maxent-3.0.2-incubating
>            Reporter: Steven Bethard
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira