import java.util.Date;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.SimpleTimeZone;
import java.util.SortedMap;
for (String header : sortedHeaders) {
if (buffer.length() > 0)
buffer.append(";"); //$NON-NLS-1$
- buffer.append(header.toLowerCase());
+ buffer.append(header.toLowerCase(Locale.ROOT));
}
return buffer.toString();
StringBuilder buffer = new StringBuilder();
for (String key : sortedHeaders) {
- buffer.append(key.toLowerCase().replaceAll("\\s+", " ") + ":" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ buffer.append(
+ key.toLowerCase(Locale.ROOT).replaceAll("\\s+", " ") + ":" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ headers.get(key).replaceAll("\\s+", " ")); //$NON-NLS-1$//$NON-NLS-2$
buffer.append("\n"); //$NON-NLS-1$
}
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;
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
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;
* 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;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
@Option(name = "--date", usage = "usage_date")
void dateFormat(String date) {
- if (date.toLowerCase().equals(date))
- date = date.toUpperCase();
+ if (date.toLowerCase(Locale.ROOT).equals(date))
+ date = date.toUpperCase(Locale.ROOT);
dateFormatter = new GitDateFormatter(Format.valueOf(date));
}
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import org.eclipse.jgit.awtui.AwtAuthenticator;
import org.eclipse.jgit.awtui.AwtCredentialsProvider;
}
if (version) {
- String cmdId = Version.class.getSimpleName().toLowerCase();
+ String cmdId = Version.class.getSimpleName()
+ .toLowerCase(Locale.ROOT);
subcommand = CommandCatalog.get(cmdId).create();
}
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import java.util.Locale;
+
import org.eclipse.jgit.errors.InvalidObjectIdException;
import org.junit.Test;
public void test011_toString() {
final String x = "0123456789ABCDEFabcdef1234567890abcdefAB";
final ObjectId oid = ObjectId.fromString(x);
- assertEquals(x.toLowerCase(), oid.name());
+ assertEquals(x.toLowerCase(Locale.ROOT), oid.name());
}
@Test(expected = InvalidObjectIdException.class)
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Locale;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
Set<String> source = Security.getAlgorithms("Cipher");
Set<String> target = new TreeSet<String>();
for (String algo : source) {
- algo = algo.toUpperCase();
+ algo = algo.toUpperCase(Locale.ROOT);
if (algo.matches(regex)) {
target.add(algo);
}
for (String source : cipherSet) {
// Standard names are not case-sensitive.
// http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html
- String target = algorithm.toUpperCase();
+ String target = algorithm.toUpperCase(Locale.ROOT);
if (source.equalsIgnoreCase(target)) {
return true;
}
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import org.eclipse.jgit.api.MergeResult.MergeStatus;
FF_ONLY;
public String toConfigValue() {
- return "--" + name().toLowerCase().replace('_', '-'); //$NON-NLS-1$
+ return "--" + name().toLowerCase(Locale.ROOT).replace('_', '-'); //$NON-NLS-1$
}
public boolean matchConfigValue(String in) {
import java.text.MessageFormat;
import java.text.ParseException;
import java.util.HashSet;
+import java.util.Locale;
import java.util.Objects;
import java.util.Set;
if (symLinks != null)
cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_SYMLINKS, symLinks.name()
- .toLowerCase());
+ .toLowerCase(Locale.ROOT));
cfg.setInt(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, 0);
cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
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;
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);
}
package org.eclipse.jgit.patch;
+import java.util.Locale;
+
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.util.RawParseUtils;
@Override
public String toString() {
final StringBuilder r = new StringBuilder();
- r.append(getSeverity().name().toLowerCase());
+ r.append(getSeverity().name().toLowerCase(Locale.ROOT));
r.append(": at offset "); //$NON-NLS-1$
r.append(getOffset());
r.append(": "); //$NON-NLS-1$
package org.eclipse.jgit.revwalk;
+import java.util.Locale;
+
import org.eclipse.jgit.lib.Constants;
/** Case insensitive key for a {@link FooterLine}. */
*/
public FooterKey(final String keyName) {
name = keyName;
- raw = Constants.encode(keyName.toLowerCase());
+ raw = Constants.encode(keyName.toLowerCase(Locale.ROOT));
}
/** @return name of this footer line. */
import java.io.File;
import java.io.IOException;
import java.text.MessageFormat;
+import java.util.Locale;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheIterator;
ConfigConstants.CONFIG_KEY_IGNORE);
if (name == null)
return null;
- return IgnoreSubmoduleMode.valueOf(name.trim().toUpperCase());
+ return IgnoreSubmoduleMode
+ .valueOf(name.trim().toUpperCase(Locale.ROOT));
}
/**
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
SCHEMA_NAME_SEPARATOR, 2);
try {
- Type methodType = Type.valueOf(valuePart[0].toUpperCase());
+ Type methodType = Type.valueOf(
+ valuePart[0].toUpperCase(Locale.ROOT));
if ((ignoreTypes != null)
&& (ignoreTypes.contains(methodType))) {
GSSManager gssManager = GSS_MANAGER_FACTORY.newInstance(conn
.getURL());
String host = conn.getURL().getHost();
- String peerName = "HTTP@" + host.toLowerCase(); //$NON-NLS-1$
+ String peerName = "HTTP@" + host.toLowerCase(Locale.ROOT); //$NON-NLS-1$
try {
GSSName gssName = gssManager.createName(peerName,
GSSName.NT_HOSTBASED_SERVICE);
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
import java.util.regex.Matcher;
matcher.reset(line);
while (matcher.find()) {
- String command = matcher.group().toLowerCase();
+ String command = matcher.group().toLowerCase(Locale.ROOT);
if (command.startsWith("#")) { //$NON-NLS-1$
matcher.reset(""); //$NON-NLS-1$
continue;
import java.util.EnumSet;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Set;
import org.eclipse.jgit.errors.NoRemoteRepositoryException;
public Process exec(String command, int timeout)
throws TransportException {
String ssh = SystemReader.getInstance().getenv("GIT_SSH"); //$NON-NLS-1$
- boolean putty = ssh.toLowerCase().contains("plink"); //$NON-NLS-1$
+ boolean putty = ssh.toLowerCase(Locale.ROOT).contains("plink"); //$NON-NLS-1$
List<String> args = new ArrayList<String>();
args.add(ssh);
- if (putty && !ssh.toLowerCase().contains("tortoiseplink")) //$NON-NLS-1$
+ if (putty
+ && !ssh.toLowerCase(Locale.ROOT).contains("tortoiseplink")) //$NON-NLS-1$
args.add("-batch"); //$NON-NLS-1$
if (0 < getURI().getPort()) {
args.add(putty ? "-P" : "-p"); //$NON-NLS-1$ //$NON-NLS-2$
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.KeySpec;
import java.text.MessageFormat;
+import java.util.Locale;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
// Standard names are not case-sensitive.
// http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html
- String cryptoName = cryptoAlg.toUpperCase();
+ String cryptoName = cryptoAlg.toUpperCase(Locale.ROOT);
if (!cryptoName.startsWith("PBE")) //$NON-NLS-1$
throw new GeneralSecurityException(JGitText.get().encryptionOnlyPBE);
SecretKey keyBase = factory.generateSecret(keySpec);
- String name = cipherAlgo.toUpperCase();
+ String name = cipherAlgo.toUpperCase(Locale.ROOT);
Matcher matcherPBE = Pattern.compile(REGEX_PBE).matcher(name);
Matcher matcherTrans = Pattern.compile(REGEX_TRANS).matcher(name);
if (matcherPBE.matches()) {
JGitV1(String algo, String pass)
throws GeneralSecurityException {
super(wrap(algo, pass));
- String name = cipherAlgo.toUpperCase();
+ String name = cipherAlgo.toUpperCase(Locale.ROOT);
Matcher matcherPBE = Pattern.compile(REGEX_PBE).matcher(name);
if (!matcherPBE.matches())
throw new GeneralSecurityException(
import java.text.Normalizer.Form;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import java.util.regex.Pattern;
import org.eclipse.jgit.internal.JGitText;
public static boolean isStaleFileHandle(IOException ioe) {
String msg = ioe.getMessage();
return msg != null
- && msg.toLowerCase().matches("stale .*file .*handle"); //$NON-NLS-1$
+ && msg.toLowerCase(Locale.ROOT)
+ .matches("stale .*file .*handle"); //$NON-NLS-1$
}
/**