picimako opened a new issue, #12809:
URL: https://github.com/apache/lucene/issues/12809

   ### Description
   
   Hi,
   
   I've been looking into how 
[`org.apache.lucene.luke.app.desktop.util.TextAreaPrintStream`](https://github.com/apache/lucene/blob/main/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/util/TextAreaPrintStream.java)
 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to