ctongfei / progressbar

Terminal-based progress bar for Java / JVM
http://tongfei.me/progressbar/
MIT License
1.07k stars 102 forks source link

Work around bugs in java.util.Spliterator#estimateSize #141

Closed seanf closed 1 year ago

seanf commented 2 years ago

Some Spliterators have bugs in their estimateSize methods, and introducing ProgressBar can trigger these bugs when it tries to determine the initialMax value. It would be good to have ProgressBar.wrap catch any exceptions and do its best to continue. This of courses raises the question of exception logging.

Would you be open to a PR which makes this change?

ctongfei commented 1 year ago

It sounds interesting -- how should we handle the exception? Just ignore it and continue as if it is indefinite? This is already the behavior for InputStreams. I'll do the same for Spliterators. Thanks!

seanf commented 1 year ago

Thank you!