Fix divide by zero in trace logging (Fixes #550) (#561)

This commit is contained in:
Jeroen van Erp
2020-02-19 10:27:00 +01:00
committed by GitHub
parent 989fb8cde6
commit 56ef6c1223

View File

@@ -54,7 +54,11 @@ public class LoggingTransferListener
public void reportProgress(long transferred) public void reportProgress(long transferred)
throws IOException { throws IOException {
if (log.isTraceEnabled()) { if (log.isTraceEnabled()) {
log.trace("transferred {}% of `{}`", ((transferred * 100) / size), path); long percent = 100;
if (size > 0) {
percent = (transferred * 100)/size;
}
log.trace("transferred {}% of `{}`", percent, path);
} }
} }
}; };