[ https://issues.apache.org/jira/browse/LUCENE-5259?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Muir updated LUCENE-5259: -------------------------------- Attachment: LUCENE-5259.patch Here's a patch (still running tests). I think most of these consumers (except indexwriter) are all technically buggy today. But this also makes the code simpler, a lot of them had complicated AND buggy exception handling. > convert analysis consumers to try-with-resources > ------------------------------------------------ > > Key: LUCENE-5259 > URL: https://issues.apache.org/jira/browse/LUCENE-5259 > Project: Lucene - Core > Issue Type: Bug > Reporter: Robert Muir > Attachments: LUCENE-5259.patch > > > Most of these consumers' exception handling is questionable at best. > if you do it with try-with-resources, then its obvious its correct: > {code} > try (TokenStream stream = analyzer.tokenStream("body", "testing")) { > stream.reset(); > while (stream.incrementToken()) { > ... > } > stream.end(); > } > {code} > For trunk we should change the consumers to work this way. For 4.x we can > simulate it with IOUtils -- This message was sent by Atlassian JIRA (v6.1#6144) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org