lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-4165) HunspellDictionary - AffixFile Reader closed, Dictionary Readers left unclosed
Date Tue, 26 Jun 2012 14:02:44 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-4165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13401401#comment-13401401
] 

Uwe Schindler commented on LUCENE-4165:
---------------------------------------

bq. to use a Reader, which does not delegate the close call to the stream

Java Readers do this. The only workaround is e.g. TIKA's CloseShieldInputStream. If you wrap
it between the original stream and your InputStreamReader on top, then you can call close
on the InputStreamReader.

About the misunderstanding: The counterpart for close() is the ctor, and close() closes the
"underlying" "opened" resource (this is what the docs says). This resource is the stream and
nothing else. If you call close on a decorator (like InputStreamReader, BufferedInputStrea),
the close call closes the underlying "opened" resource. It talks about nothing else.

As I said, XERCES UTF8Reader is already horribly broken, it violates Unicode specs and lots
of other stuff + it is horribly slow, so its a bad example. If it allocates ThreadLocals,
there is no need / requirement to release them on close(). Close() should only close the underlying
resource, not any helpers around.
                
> HunspellDictionary - AffixFile Reader closed, Dictionary Readers left unclosed
> ------------------------------------------------------------------------------
>
>                 Key: LUCENE-4165
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4165
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/analysis
>    Affects Versions: 3.6
>         Environment: Linux, Java 1.6
>            Reporter: Torsten Krah
>            Priority: Minor
>         Attachments: lucene_36.patch, lucene_trunk.patch
>
>
> The HunspellDictionary takes an InputStream for affix file and a List of Streams for
dictionaries.
> Javadoc is not clear about i have to close those stream myself or the Dictionary constructor
does this already.
> Looking at the code, at least reader.close() is called when the affix file is read via
readAffixFile() method (although closing streams is not done in a finally block - so the constructor
may fail to do so).
> The readDictionaryFile() method does miss the call to close the reader in contrast to
readAffixFile().
> So the question here is - have i have to close the streams myself after instantiating
the dictionary?
> Or is the close call only missing for the dictionary streams?
> Either way, please add the close calls in a safe manner or clarify javadoc so i have
to do this myself.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message