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.lfs | |
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.lfs')
-rw-r--r-- | org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/LfsPointer.java | 3 |
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; |