lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Potential Resource Leak warning in Analyer.createComponents()
Date Wed, 21 Nov 2012 15:18:41 GMT
Disable this warning, your workaround is worse than the warning.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Carsten Schnober [mailto:schnober@ids-mannheim.de]
> Sent: Wednesday, November 21, 2012 2:51 PM
> To: java-user
> Subject: Potential Resource Leak warning in Analyer.createComponents()
> 
> Hi,
> I use a custom analyzer and tokenizer. The analyzer is very basic and it merely
> comprises the method createComponents():
> 
> -------------------------------------------------------------
> @Override
> protected TokenStreamComponents createComponents(String fieldName,
> Reader reader) {
>   return new TokenStreamComponents(new KoraTokenizer(reader)); }
> -------------------------------------------------------------
> 
> Eclipse gives me a warning though "potential resource leak" because the
> tokenizer is never closed. This is clearly true but is it not desirable either, is it?
> To get rid of the warning, I had experimentally changed the method to this:
> 
> Tokenizer source = new KoraTokenizer(reader); TokenStreamComponents ts
> = new TokenStreamComponents(source); source.close(); return ts;
> 
> This yields what I had expected, namely a null TokenStream during analysis.
> So regarding the results, I think the initial version is right, but I am suspicious
> against the resource leak warning. How serious is it?
> Best,
> Carsten
> 
> 
> --
> Institut für Deutsche Sprache | http://www.ids-mannheim.de
> Projekt KorAP                 | http://korap.ids-mannheim.de
> Tel. +49-(0)621-43740789      | schnober@ids-mannheim.de
> Korpusanalyseplattform der nächsten Generation Next Generation Corpus
> Analysis Platform
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


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


Mime
View raw message