You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/05/19 09:21:05 UTC
git commit: [flex-utilities] [refs/heads/develop] - Try to resolve
downloading issues on some machines.
Repository: flex-utilities
Updated Branches:
refs/heads/develop 4475095f5 -> f38b2f833
Try to resolve downloading issues on some machines.
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/f38b2f83
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/f38b2f83
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/f38b2f83
Branch: refs/heads/develop
Commit: f38b2f833938036440624d778fcba39aff41558a
Parents: 4475095
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Thu May 19 11:20:56 2016 +0200
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Thu May 19 11:20:56 2016 +0200
----------------------------------------------------------------------
.../retrievers/download/DownloadRetriever.java | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f38b2f83/flex-maven-tools/flex-sdk-converter/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
----------------------------------------------------------------------
diff --git a/flex-maven-tools/flex-sdk-converter/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java b/flex-maven-tools/flex-sdk-converter/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
index 096907e..bb4370e 100644
--- a/flex-maven-tools/flex-sdk-converter/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
+++ b/flex-maven-tools/flex-sdk-converter/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
@@ -59,6 +59,8 @@ public class DownloadRetriever extends BaseRetriever {
public static final String FLEX_INSTALLER_CONFIG_URL =
"http://flex.apache.org/installer/sdk-installer-config-4.0.xml";
+ public static final long MEGABYTE = 1 << 20;
+
/**
* Wrapper to allow simple overriding of this property.
*
@@ -257,16 +259,21 @@ public class DownloadRetriever extends BaseRetriever {
content.close();
}
} else {
- long transferedSize = 0L;
if (expectedSize > 1014 * 1024) {
System.out.println("Expected size: " + (expectedSize / 1024 / 1024) + "MB");
} else {
System.out.println("Expected size: " + (expectedSize / 1024) + "KB");
}
final ProgressBar progressBar = new ProgressBar(expectedSize);
- while (transferedSize < expectedSize) {
- transferedSize += fos.getChannel().transferFrom(rbc, transferedSize, 1 << 20);
- progressBar.updateProgress(transferedSize);
+ long transferredSize = 0L;
+ while ((expectedSize == 0) || (transferredSize < expectedSize)) {
+ // Transfer about 1MB in each iteration.
+ long currentSize = fos.getChannel().transferFrom(rbc, transferredSize, MEGABYTE);
+ if(currentSize < MEGABYTE) {
+ break;
+ }
+ transferredSize += currentSize;
+ progressBar.updateProgress(transferredSize);
}
fos.close();
System.out.println();