Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-04-17 08:30:47 -0400
committerUwe Stieber2014-04-17 08:30:47 -0400
commitb1c7ba2bf3ccf99c665051c5ecdac9762e02ae57 (patch)
treef2d6e498770cb8894e18a25e3b8e7cde6a4d66b9
parent1cd1078a5723555329541b55bf1017b5634a143c (diff)
downloadorg.eclipse.tcf-b1c7ba2bf3ccf99c665051c5ecdac9762e02ae57.tar.gz
org.eclipse.tcf-b1c7ba2bf3ccf99c665051c5ecdac9762e02ae57.tar.xz
org.eclipse.tcf-b1c7ba2bf3ccf99c665051c5ecdac9762e02ae57.zip
Target Explorer: Fix FileTransferService throws ArithmeticException
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java
index eca094bbe..f7567ecde 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java
@@ -371,7 +371,7 @@ public class FileTransferService {
long timestamp = System.currentTimeMillis();
speed = ((bytesDone) * 1000) / Math.max(timestamp - startTimeStamp, 1);
- ProgressHelper.worked(monitor, (int)((bytesRead/bytesTotal) * 1000));
+ ProgressHelper.worked(monitor, (int)((bytesRead/(bytesTotal > 0 ? bytesTotal : 1000)) * 1000));
ProgressHelper.setSubTaskName(monitor, getProgressMessage(bytesDone, bytesTotal, speed));
}
}
@@ -432,7 +432,7 @@ public class FileTransferService {
speed = "GB/s"; //$NON-NLS-1$
}
- return bytesDone + done + " of " + bytesTotal + total + " at " + bytesSpeed + speed; //$NON-NLS-1$ //$NON-NLS-2$
+ return bytesDone + done + " of " + (bytesTotal > 0 ? Long.toString(bytesTotal) : "N/A") + total + " at " + bytesSpeed + speed; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}

Back to the top