You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Digy (Resolved) (JIRA)" <ji...@apache.org> on 2011/11/11 09:18:51 UTC

[Lucene.Net] [jira] [Resolved] (LUCENENET-443) SpellChecker finaliser calls close regardless of if closed already

     [ https://issues.apache.org/jira/browse/LUCENENET-443?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Digy resolved LUCENENET-443.
----------------------------

    Resolution: Fixed
    
> SpellChecker finaliser calls close regardless of if closed already
> ------------------------------------------------------------------
>
>                 Key: LUCENENET-443
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-443
>             Project: Lucene.Net
>          Issue Type: Improvement
>          Components: Lucene.Net Contrib
>    Affects Versions: Lucene.Net 2.9.2
>            Reporter: Stuart Robinson
>            Assignee: michael herndon
>              Labels: lucene, spellcheck, spellchecker
>             Fix For: Lucene.Net 2.9.4, Lucene.Net 2.9.4g
>
>
> The SpellChecker Class currently has no publicly visible way of accessing the closed field. It also calls close in the finaliser killing the process it is in upon GC as this can throw an exceptin. I propose two changes:
> Change the already existing method "IsClosed()" to public:
>         public bool IsClosed()
>         {
>             return closed;
>         }
> and add a check on this in the finaliser:
>         ~SpellChecker()
>         {
>             if (!IsClosed())
>                 this.Close();
>         }
> Ideally this class should implement IDisposable but I think this would be a bigger job than this two line change.

--
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