[MNG-8339] An error during transfer output seems to freeze the output (#1842)

This commit is contained in:
Guillaume Nodet 2024-10-24 14:02:04 +02:00 committed by GitHub
parent b5a8a8a349
commit c5a1c53e5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -80,8 +80,9 @@ public void transferProgressed(TransferEvent event) throws TransferCancelledExce
Iterator<TransferResourceAndSize> entries = transfers.values().iterator();
while (entries.hasNext()) {
TransferResourceAndSize entry = entries.next();
long total = entry.resource.getContentLength();
Long complete = entry.transferredBytes;
// just in case, make sure 0 <= complete <= total
long complete = Math.max(0, entry.transferredBytes);
long total = Math.max(complete, entry.resource.getContentLength());
String resourceName = entry.resource.getResourceName();