Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2017-01-28 14:06:15 +0000
committerMatthias Sohn2017-01-28 14:06:15 +0000
commita4feeb01945e039b39a246f96a1a91b0e4836f01 (patch)
tree087e1b48290ed529412e8ad48efa341952ee2f1b /org.eclipse.jgit.lfs
parent2eb1bebd605852b7ef240e700943dfba7c0a1b3f (diff)
downloadjgit-a4feeb01945e039b39a246f96a1a91b0e4836f01.tar.gz
jgit-a4feeb01945e039b39a246f96a1a91b0e4836f01.tar.xz
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.lfs')
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java
index 0aee1aadde..0f62025be5 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java
@@ -51,6 +51,7 @@ import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.nio.charset.UnsupportedCharsetException;
+import java.util.Locale;
import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.lfs.lib.AnyLongObjectId;
@@ -79,7 +80,7 @@ public class LfsPointer {
* evaluate to "sha256"
*/
public static final String HASH_FUNCTION_NAME = Constants.LONG_HASH_FUNCTION
- .toLowerCase().replace("-", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ .toLowerCase(Locale.ROOT).replace("-", ""); //$NON-NLS-1$ //$NON-NLS-2$
private AnyLongObjectId oid;

Back to the top