Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2017-01-28 09:10:20 -0500
committerMatthias Sohn2017-01-30 16:53:28 -0500
commitdaca0edba32687fe8a777df0da487da017f601e0 (patch)
tree56bd750dcdf1abfcdc5aab2129e261ab2a094783 /org.eclipse.egit.core.test/src
parent76acd28a6f4d0f38a8a6f5a8c3c347155917ff26 (diff)
downloadegit-daca0edba32687fe8a777df0da487da017f601e0.tar.gz
egit-daca0edba32687fe8a777df0da487da017f601e0.tar.xz
egit-daca0edba32687fe8a777df0da487da017f601e0.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: I5619ce1bde33d6ce2469506a915af9203bae0314 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.core.test/src')
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java
index 11a536b2d..d611d5fa5 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/op/ConnectProviderOperationTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
+import java.util.Locale;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -93,10 +94,10 @@ public class ConnectProviderOperationTest extends GitTestCase {
// not windows???
return;
}
- if (!device.toLowerCase().equals(device)) {
- path = path.setDevice(device.toLowerCase());
+ if (!device.toLowerCase(Locale.ROOT).equals(device)) {
+ path = path.setDevice(device.toLowerCase(Locale.ROOT));
} else {
- path = path.setDevice(device.toUpperCase());
+ path = path.setDevice(device.toUpperCase(Locale.ROOT));
}
assertNotEquals(path, new Path(gitDir.toString()));
assertNotEquals(path.toFile().toString(),

Back to the top