From 8161db33a11357233f0e331beea636fff4012300 Mon Sep 17 00:00:00 2001 From: Coda Hale Date: Thu, 2 May 2013 11:31:18 -0700 Subject: [PATCH] Specify English locale for Size and Duration units. --- .../src/main/java/com/codahale/dropwizard/util/Duration.java | 3 ++- .../src/main/java/com/codahale/dropwizard/util/Size.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dropwizard-util/src/main/java/com/codahale/dropwizard/util/Duration.java b/dropwizard-util/src/main/java/com/codahale/dropwizard/util/Duration.java index effd14a790f..8e72868147f 100644 --- a/dropwizard-util/src/main/java/com/codahale/dropwizard/util/Duration.java +++ b/dropwizard-util/src/main/java/com/codahale/dropwizard/util/Duration.java @@ -5,6 +5,7 @@ import com.google.common.base.CharMatcher; import com.google.common.collect.ImmutableMap; +import java.util.Locale; import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; @@ -163,7 +164,7 @@ public int hashCode() { @Override @JsonValue public String toString() { - String units = unit.toString().toLowerCase(); + String units = unit.toString().toLowerCase(Locale.ENGLISH); if (count == 1) { units = units.substring(0, units.length() - 1); } diff --git a/dropwizard-util/src/main/java/com/codahale/dropwizard/util/Size.java b/dropwizard-util/src/main/java/com/codahale/dropwizard/util/Size.java index 01c1de4dc13..7665a5a297e 100644 --- a/dropwizard-util/src/main/java/com/codahale/dropwizard/util/Size.java +++ b/dropwizard-util/src/main/java/com/codahale/dropwizard/util/Size.java @@ -5,6 +5,7 @@ import com.google.common.base.CharMatcher; import com.google.common.collect.ImmutableMap; +import java.util.Locale; import java.util.regex.Pattern; import static com.google.common.base.Preconditions.checkArgument; @@ -137,7 +138,7 @@ public int hashCode() { @Override @JsonValue public String toString() { - String units = unit.toString().toLowerCase(); + String units = unit.toString().toLowerCase(Locale.ENGLISH); if (count == 1) { units = units.substring(0, units.length() - 1); }