From 8109314f6ab0d86120b443251c9abbb335058269 Mon Sep 17 00:00:00 2001 From: Artur Date: Mon, 28 Aug 2017 16:13:46 +0300 Subject: [PATCH] Fix capitalization of single character strings (#9880) --- shared/src/main/java/com/vaadin/shared/util/SharedUtil.java | 2 +- shared/src/test/java/com/vaadin/shared/util/SharedUtilTest.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/src/main/java/com/vaadin/shared/util/SharedUtil.java b/shared/src/main/java/com/vaadin/shared/util/SharedUtil.java index eaf8729a5e..974c45ae02 100644 --- a/shared/src/main/java/com/vaadin/shared/util/SharedUtil.java +++ b/shared/src/main/java/com/vaadin/shared/util/SharedUtil.java @@ -199,7 +199,7 @@ public class SharedUtil implements Serializable { } if (string.length() <= 1) { - return string.toUpperCase(); + return string.toUpperCase(Locale.ENGLISH); } return string.substring(0, 1).toUpperCase(Locale.ENGLISH) diff --git a/shared/src/test/java/com/vaadin/shared/util/SharedUtilTest.java b/shared/src/test/java/com/vaadin/shared/util/SharedUtilTest.java index 791637e1b1..b468093da1 100644 --- a/shared/src/test/java/com/vaadin/shared/util/SharedUtilTest.java +++ b/shared/src/test/java/com/vaadin/shared/util/SharedUtilTest.java @@ -113,6 +113,7 @@ public class SharedUtilTest { try { Locale.setDefault(new Locale("tr", "TR")); Assert.assertEquals("Integer", SharedUtil.capitalize("integer")); + Assert.assertEquals("I", SharedUtil.capitalize("i")); } finally { Locale.setDefault(defaultLocale); } -- 2.39.5