diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/BUILD b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/BUILD index 82aa46a2ad8829..5b383ce7237f8d 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/BUILD +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/BUILD @@ -30,5 +30,6 @@ java_library( "//third_party:auto_value", "//third_party:guava", "//third_party:jsr305", + "//third_party:apache_commons_io", ], ) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/DownloadProgressEvent.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/DownloadProgressEvent.java index 637c794247f659..200e32dc814ea4 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/DownloadProgressEvent.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/DownloadProgressEvent.java @@ -16,8 +16,8 @@ import com.google.devtools.build.lib.events.ExtendedEventHandler; import java.net.URL; -import java.text.NumberFormat; import java.util.Locale; +import org.apache.commons.io.FileUtils; /** * Postable event reporting on progress made downloading an URL. It can be used to report the URL @@ -73,9 +73,7 @@ public long getBytesRead() { @Override public String getProgress() { if (bytesRead > 0) { - NumberFormat formatter = NumberFormat.getIntegerInstance(Locale.ENGLISH); - formatter.setGroupingUsed(true); - return formatter.format(bytesRead) + "B"; + return String.format("%s (%,dB)", FileUtils.byteCountToDisplaySize(bytesRead), bytesRead); } else { return ""; }