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.test/tst | |
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.test/tst')
-rw-r--r-- | org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LongObjectIdTest.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LongObjectIdTest.java b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LongObjectIdTest.java index 435a2a3c39..68dcf806b8 100644 --- a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LongObjectIdTest.java +++ b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LongObjectIdTest.java @@ -57,6 +57,7 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; +import java.util.Locale; import org.eclipse.jgit.junit.JGitTestUtil; import org.eclipse.jgit.lfs.errors.InvalidLongObjectIdException; @@ -152,7 +153,7 @@ public class LongObjectIdTest { public void test011_toString() { final String x = "0123456789ABCDEFabcdef01234567890123456789ABCDEFabcdef0123456789"; final LongObjectId oid = LongObjectId.fromString(x); - assertEquals(x.toLowerCase(), oid.name()); + assertEquals(x.toLowerCase(Locale.ROOT), oid.name()); } @Test |