You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using an indefinite progress bar, and if the setExtraMessage() value is too long, ProgressBar throws an Arithmetic exception for a divide by zero. It comes from DefaultProgressBarRenderer line 96:
int pos = (int)(progress.current % length);
An example:
public static void main(String[] args) throws InterruptedException {
try (ProgressBar pb = new ProgressBar("test", -1)) {
for (int i = 0; i < 10; i++) {
pb.step();
// May differ for your terminal...
// Mine breaks and is "too long" when I get to 38: |
// (At 37, it breaks when the counter goes double digits)
pb.setExtraMessage(Paths.get("12345678901234567890123456789012345678").toString());
TimeUnit.MILLISECONDS.sleep(250);
}
}
}
Stack trace looks like this;
Exception in thread "me.tongfei.progressbar.ProgressBar" java.lang.ArithmeticException: / by zero
at me.tongfei.progressbar.DefaultProgressBarRenderer.render(DefaultProgressBarRenderer.java:96)
at me.tongfei.progressbar.ProgressThread.refresh(ProgressThread.java:37)
at me.tongfei.progressbar.ProgressThread.run(ProgressThread.java:48)
at java.lang.Thread.run(Thread.java:748)
The text was updated successfully, but these errors were encountered:
I'm using an indefinite progress bar, and if the setExtraMessage() value is too long, ProgressBar throws an Arithmetic exception for a divide by zero. It comes from DefaultProgressBarRenderer line 96:
int pos = (int)(progress.current % length);
An example:
Stack trace looks like this;
The text was updated successfully, but these errors were encountered: