lucene
lucene copied to clipboard
Simplifying TextAreaPrintStream in Luke
Description
Hi,
I've been looking into how org.apache.lucene.luke.app.desktop.util.TextAreaPrintStream is used in Luke, and I think its usage and its implementation may be simplified.
- It is used in
OptimizeIndexDialogFactory.ListenerFunctionsandCheckIndexDialogFactory.ListenerFunctions, both in a try-catch. SinceTextAreaPrintStreamis closable, my first suggestion would be to use try-with-resources instead at those locations. - Since there is always a new instance of
TextAreaPrintStreaminstance created at the aforementioned locations, and they are flushed afterwards, it seems unnecessary to store theByteArrayOutputStream baosfield and call .reset() at all, when theTextAreaPrintStreaminstances are not reused.
Let me know what you think.
Hi, Can you please review my PR for this ticket?