Ignore:
Timestamp:
2016-01-03T12:13:44+01:00 (8 years ago)
Author:
simon04
Message:

Uniform display of sizes (B, kB, MB, ...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/HttpClient.java

    r9255 r9274  
    1313import java.net.URL;
    1414import java.util.List;
     15import java.util.Locale;
    1516import java.util.Map;
    1617import java.util.Scanner;
     
    99100
    100101        if ("PUT".equals(requestMethod) || "POST".equals(requestMethod) || "DELETE".equals(requestMethod)) {
    101             Main.info("{0} {1} ({2} kB) ...", requestMethod, url, requestBody.length / 1024);
     102            Main.info("{0} {1} ({2}) ...", requestMethod, url, Utils.getSizeString(requestBody.length, Locale.getDefault()));
    102103            headers.put("Content-Length", String.valueOf(requestBody.length));
    103104            connection.setDoOutput(true);
     
    116117                        requestMethod, url, hasReason ? " (" + reasonForRequest + ")" : "",
    117118                        connection.getResponseCode(),
    118                         connection.getContentLengthLong() > 0 ? " (" + connection.getContentLengthLong() / 1024 + "KB)" : ""
     119                        connection.getContentLengthLong() > 0
     120                                ? " (" + Utils.getSizeString(connection.getContentLengthLong(), Locale.getDefault()) + ")"
     121                                : ""
    119122                );
    120123                if (Main.isDebugEnabled()) {
Note: See TracChangeset for help on using the changeset viewer.