diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2017-01-28 15:06:15 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2017-01-28 15:06:15 +0100 |
commit | a4feeb01945e039b39a246f96a1a91b0e4836f01 (patch) | |
tree | 087e1b48290ed529412e8ad48efa341952ee2f1b /org.eclipse.jgit/src/org/eclipse/jgit/lib | |
parent | 2eb1bebd605852b7ef240e700943dfba7c0a1b3f (diff) | |
download | jgit-a4feeb01945e039b39a246f96a1a91b0e4836f01.tar.gz jgit-a4feeb01945e039b39a246f96a1a91b0e4836f01.zip |
Don't rely on default locale when using toUpperCase() and toLowerCase()
Otherwise these methods may produce unexpected results if used for
strings that are intended to be interpreted locale independently.
Examples are programming language identifiers, protocol keys, and HTML
tags. For instance, "TITLE".toLowerCase() in a Turkish locale returns
"t\u0131tle", where '\u0131' is the LATIN SMALL LETTER DOTLESS I
character.
See
https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#toLowerCase--
http://blog.thetaphi.de/2012/07/default-locales-default-charsets-and.html
Bug: 511238
Change-Id: Id8d8f37d84d62239c918b81f8d883ed798d87656
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java index 8fe8a96e99..ec771a24f0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java @@ -58,6 +58,7 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; @@ -895,7 +896,7 @@ public class Config { if (value instanceof ConfigEnum) n = ((ConfigEnum) value).toConfigValue(); else - n = value.name().toLowerCase().replace('_', ' '); + n = value.name().toLowerCase(Locale.ROOT).replace('_', ' '); setString(section, subsection, name, n); } |