Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Sievers2015-08-21 13:51:30 +0000
committerJan Sievers2015-08-21 14:57:59 +0000
commitaafd79fec2370308823fe0626f86edba318d1607 (patch)
treeadde3ef3a9da3073bd4e0ff67eed47f5bfb44ffe
parent803fb88bedb715be74bcaf9f1b3b963194a5521b (diff)
downloadrt.equinox.p2-aafd79fec2370308823fe0626f86edba318d1607.tar.gz
rt.equinox.p2-aafd79fec2370308823fe0626f86edba318d1607.tar.xz
rt.equinox.p2-aafd79fec2370308823fe0626f86edba318d1607.zip
Bug 474863: don't report download speed as 0 if no data availableI20150825-0800
if no download speed data is available (yet), do not report download "0B at 0 B/s". This may happen for smaller files that are downloaded faster than the speed resolution of 1 second. However display total file size info if available. Change-Id: I4f4e530230c74985de36a1fd8ea053106adde64f Signed-off-by: Jan Sievers <jan.sievers@sap.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Messages.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/messages.properties2
3 files changed, 12 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Messages.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Messages.java
index 822f3c19f..99622c02c 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/Messages.java
@@ -73,6 +73,8 @@ public class Messages extends NLS {
public static String TransportErrorTranslator_UnknownErrorCode;
public static String TransportErrorTranslator_UnknownHost;
+ public static String fetching_0_from_1;
+ public static String fetching_0_from_1_2;
public static String fetching_0_from_1_2_at_3;
public static String fetching_0_from_1_2_of_3_at_4;
public static String connection_to_0_failed_on_1_retry_attempt_2;
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
index dd878fd67..046f81232 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/ProgressStatistics.java
@@ -148,6 +148,14 @@ public class ProgressStatistics {
String uriString = m_uri.toString();
if (m_fileName != null && uriString.endsWith(m_fileName))
uriString = uriString.substring(0, uriString.lastIndexOf(m_fileName));
+ if (m_current == 0L || getRecentSpeed() == 0L) {
+ // no meaningful speed data available
+ if (m_total == -1) {
+ return NLS.bind(Messages.fetching_0_from_1, new String[] {m_fileName, uriString});
+ } else {
+ return NLS.bind(Messages.fetching_0_from_1_2, new String[] {m_fileName, uriString, convert(m_total)});
+ }
+ }
return m_total != -1 ? NLS.bind(Messages.fetching_0_from_1_2_of_3_at_4, new String[] {m_fileName, uriString, convert(m_current), convert(m_total), convert(getRecentSpeed())}) : NLS.bind(Messages.fetching_0_from_1_2_at_3, new String[] {m_fileName, uriString, convert(m_current), convert(getRecentSpeed())});
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/messages.properties b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/messages.properties
index 8d65bed0e..6582fe6df 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/messages.properties
@@ -67,6 +67,8 @@ TransportErrorTranslator_MalformedRemoteFileReference=Malformed reference to rem
TransportErrorTranslator_UnableToConnectToRepository_0=Unable to connect to repository {0}
TransportErrorTranslator_UnknownErrorCode=HTTP Server Unknown HTTP Response Code ({0}):{1}
TransportErrorTranslator_UnknownHost=Unknown Host: {0}
+fetching_0_from_1=Fetching {0} from {1}
+fetching_0_from_1_2=Fetching {0} from {1} ({2})
fetching_0_from_1_2_at_3=Fetching {0} from {1} ({2} at {3}/s)
fetching_0_from_1_2_of_3_at_4=Fetching {0} from {1} ({2} of {3} at {4}/s)
FileTransport_reader=File Transport Reader

Back to the top