lucene icon indicating copy to clipboard operation
lucene copied to clipboard

Simplifying TextAreaPrintStream in Luke

Open picimako opened this issue 2 years ago • 1 comments

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.ListenerFunctions and CheckIndexDialogFactory.ListenerFunctions, both in a try-catch. Since TextAreaPrintStream is closable, my first suggestion would be to use try-with-resources instead at those locations.
  • Since there is always a new instance of TextAreaPrintStream instance created at the aforementioned locations, and they are flushed afterwards, it seems unnecessary to store the ByteArrayOutputStream baos field and call .reset() at all, when the TextAreaPrintStream instances are not reused.

Let me know what you think.

picimako avatar Nov 15 '23 08:11 picimako

Hi, Can you please review my PR for this ticket?

pratikshelarkar avatar Dec 01 '23 18:12 pratikshelarkar