Repository: james-project Updated Branches: refs/heads/master 0cca81325 -> aee6cc7d3
JAMES-2237 Size related tests were platform dependant Depending on the host system, you could end up with a `,` or a `.`, leading to test failures. We should enforce a locale choice in order to not be platform dependant. Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/f0e3c3ac Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/f0e3c3ac Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/f0e3c3ac Branch: refs/heads/master Commit: f0e3c3ac6221e67728347c3b2fe915073f38d580 Parents: 90e28ec Author: benwa <[email protected]> Authored: Mon Dec 11 10:06:57 2017 +0700 Committer: benwa <[email protected]> Committed: Mon Dec 11 10:06:57 2017 +0700 ---------------------------------------------------------------------- .../main/java/org/apache/james/transport/util/SizeUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/f0e3c3ac/server/mailet/mailets/src/main/java/org/apache/james/transport/util/SizeUtils.java ---------------------------------------------------------------------- diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/util/SizeUtils.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/util/SizeUtils.java index e1c4cb4..843dffd 100644 --- a/server/mailet/mailets/src/main/java/org/apache/james/transport/util/SizeUtils.java +++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/util/SizeUtils.java @@ -19,10 +19,15 @@ package org.apache.james.transport.util; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; + import com.jakewharton.byteunits.BinaryByteUnit; public class SizeUtils { + public static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.US)); public static String humanReadableSize(Number size) { return humanReadableSize(size.longValue()); @@ -32,7 +37,7 @@ public class SizeUtils { if (size < 0) { return "-" + humanReadableSize(-size); } else { - return BinaryByteUnit.format(size, "#.#"); + return BinaryByteUnit.format(size, DECIMAL_FORMAT); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
