Skip to content

Commit

Permalink
adds LOCALE.English to each toUpperCase call to avoid the famous Turk…
Browse files Browse the repository at this point in the history
…ish problem

refs: #7464
  • Loading branch information
robfrank committed Jun 5, 2017
1 parent 46bbcab commit 9f70834
Show file tree
Hide file tree
Showing 63 changed files with 228 additions and 237 deletions.
Expand Up @@ -384,7 +384,7 @@ public void open(final String iUserName, final String iUserPassword, final OCont

String strategy = conf.getValueAsString(OGlobalConfiguration.CLIENT_CONNECTION_STRATEGY);
if (strategy != null)
connectionStrategy = CONNECTION_STRATEGY.valueOf(strategy.toUpperCase());
connectionStrategy = CONNECTION_STRATEGY.valueOf(strategy.toUpperCase(Locale.ENGLISH));

openRemoteDatabase();

Expand Down
Expand Up @@ -23,6 +23,8 @@
import com.orientechnologies.common.parser.OVariableParserListener;
import com.orientechnologies.orient.core.config.OGlobalConfiguration;

import java.util.Locale;

/**
* Console ANSI utility class that supports most of the ANSI amenities.
*
Expand Down Expand Up @@ -99,7 +101,7 @@ public Object resolve(final String iVariable) {

final String[] codes = code.split(":");
for (int i = 0; i < codes.length; ++i)
buffer.append(OAnsiCode.valueOf(codes[i].toUpperCase()));
buffer.append(OAnsiCode.valueOf(codes[i].toUpperCase(Locale.ENGLISH)));

if (pos > -1) {
buffer.append(text);
Expand Down
Expand Up @@ -293,7 +293,7 @@ protected Object executeSQLScript(final String iText, final ODatabaseDocument db
String next = lastCommand.substring("begin ".length()).trim();
if (OStringSerializerHelper.startsWithIgnoreCase(next, "isolation ")) {
next = next.substring("isolation ".length()).trim();
db.getTransaction().setIsolationLevel(OTransaction.ISOLATION_LEVEL.valueOf(next.toUpperCase()));
db.getTransaction().setIsolationLevel(OTransaction.ISOLATION_LEVEL.valueOf(next.toUpperCase(Locale.ENGLISH)));
}
}

Expand Down
Expand Up @@ -50,7 +50,7 @@ public Map<String, Object> getVariables() {
}

public Object getVariable(final String iName) {
final String name = iName.trim().toUpperCase();
final String name = iName.trim().toUpperCase(Locale.ENGLISH);

if ("DEPTH".startsWith(name))
return getDepth();
Expand Down
Expand Up @@ -32,6 +32,7 @@
import com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerBinary;

import java.io.PrintStream;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.ConsoleHandler;
Expand Down Expand Up @@ -914,18 +915,18 @@ public void change(final Object iCurrentValue, final Object iNewValue) {

@Deprecated CLIENT_CHANNEL_MIN_POOL("client.channel.minPool", "Minimum pool size", Integer.class, 1);

static {
readConfiguration();
}

private final String key;
private final Object defValue;
private final Class<?> type;
private volatile Object value = null;
private final String description;
private final OConfigurationChangeCallback changeCallback;
private final Boolean canChangeAtRuntime;
private final boolean hidden;

static {
readConfiguration();
}
private volatile Object value = null;

OGlobalConfiguration(final String iKey, final String iDescription, final Class<?> iType, final Object iDefValue,
final OConfigurationChangeCallback iChangeAction) {
Expand Down Expand Up @@ -969,7 +970,7 @@ public static void dumpConfiguration(final PrintStream out) {

if (!lastSection.equals(section)) {
out.print("- ");
out.println(section.toUpperCase());
out.println(section.toUpperCase(Locale.ENGLISH));
lastSection = section;
}
out.print(" + ");
Expand Down
Expand Up @@ -1114,7 +1114,7 @@ public <DB extends ODatabase> DB set(final ATTRIBUTES iAttribute, final Object i
throw new IllegalArgumentException("Timezone can't be null");

// for backward compatibility, until 2.1.13 OrientDB accepted timezones in lowercase as well
TimeZone timeZoneValue = TimeZone.getTimeZone(stringValue.toUpperCase());
TimeZone timeZoneValue = TimeZone.getTimeZone(stringValue.toUpperCase(Locale.ENGLISH));
if (timeZoneValue.equals(TimeZone.getTimeZone("GMT"))) {
timeZoneValue = TimeZone.getTimeZone(stringValue);
}
Expand Down
Expand Up @@ -22,6 +22,8 @@
import com.orientechnologies.orient.core.id.ORID;
import com.orientechnologies.orient.core.record.ORecord;

import java.util.Locale;

/**
* Contains the information about a database operation.
*
Expand Down Expand Up @@ -100,7 +102,7 @@ public static String getName(final int type) {
}

public static byte getId(String iName) {
iName = iName.toUpperCase();
iName = iName.toUpperCase(Locale.ENGLISH);

if (iName.startsWith("CREAT"))
return ORecordOperation.CREATED;
Expand Down
Expand Up @@ -152,14 +152,14 @@ public long exportRecords() throws IOException {
if (clusterName != null) {
// CHECK IF THE CLUSTER IS INCLUDED
if (includeClusters != null) {
if (!includeClusters.contains(clusterName.toUpperCase()))
if (!includeClusters.contains(clusterName.toUpperCase(Locale.ENGLISH)))
continue;
} else if (excludeClusters != null) {
if (excludeClusters.contains(clusterName.toUpperCase()))
if (excludeClusters.contains(clusterName.toUpperCase(Locale.ENGLISH)))
continue;
}

if (excludeClusters != null && excludeClusters.contains(clusterName.toUpperCase()))
if (excludeClusters != null && excludeClusters.contains(clusterName.toUpperCase(Locale.ENGLISH)))
continue;

clusterExportedRecordsTot = database.countClusterElements(clusterName);
Expand All @@ -178,7 +178,7 @@ public long exportRecords() throws IOException {
if (rec instanceof ODocument) {
// CHECK IF THE CLASS OF THE DOCUMENT IS INCLUDED
ODocument doc = (ODocument) rec;
final String className = doc.getClassName() != null ? doc.getClassName().toUpperCase() : null;
final String className = doc.getClassName() != null ? doc.getClassName().toUpperCase(Locale.ENGLISH) : null;
if (includeClasses != null) {
if (!includeClasses.contains(className))
continue;
Expand Down Expand Up @@ -275,10 +275,10 @@ private void exportClusters() throws IOException {

// CHECK IF THE CLUSTER IS INCLUDED
if (includeClusters != null) {
if (!includeClusters.contains(clusterName.toUpperCase()))
if (!includeClusters.contains(clusterName.toUpperCase(Locale.ENGLISH)))
continue;
} else if (excludeClusters != null) {
if (excludeClusters.contains(clusterName.toUpperCase()))
if (excludeClusters.contains(clusterName.toUpperCase(Locale.ENGLISH)))
continue;
}

Expand Down Expand Up @@ -465,10 +465,10 @@ private void exportSchema() throws IOException {
for (OClass cls : classes) {
// CHECK TO FILTER CLASS
if (includeClasses != null) {
if (!includeClasses.contains(cls.getName().toUpperCase()))
if (!includeClasses.contains(cls.getName().toUpperCase(Locale.ENGLISH)))
continue;
} else if (excludeClasses != null) {
if (excludeClasses.contains(cls.getName().toUpperCase()))
if (excludeClasses.contains(cls.getName().toUpperCase(Locale.ENGLISH)))
continue;
}

Expand Down
Expand Up @@ -24,10 +24,7 @@
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.metadata.OMetadataDefault;

import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.*;

/**
* Abstract class for import/export of database and data in general.
Expand Down Expand Up @@ -210,24 +207,24 @@ protected void parseSetting(final String option, final List<String> items) {
} else if (option.equalsIgnoreCase("-includeClass")) {
includeClasses = new HashSet<String>();
for (String item : items)
includeClasses.add(item.toUpperCase());
includeClasses.add(item.toUpperCase(Locale.ENGLISH));
includeRecords = true;

} else if (option.equalsIgnoreCase("-excludeClass")) {
excludeClasses = new HashSet<String>(items);
for (String item : items)
excludeClasses.add(item.toUpperCase());
excludeClasses.add(item.toUpperCase(Locale.ENGLISH));

} else if (option.equalsIgnoreCase("-includeCluster")) {
includeClusters = new HashSet<String>(items);
for (String item : items)
includeClusters.add(item.toUpperCase());
includeClusters.add(item.toUpperCase(Locale.ENGLISH));
includeRecords = true;

} else if (option.equalsIgnoreCase("-excludeCluster")) {
excludeClusters = new HashSet<String>(items);
for (String item : items)
excludeClusters.add(item.toUpperCase());
excludeClusters.add(item.toUpperCase(Locale.ENGLISH));

} else if (option.equalsIgnoreCase("-includeInfo")) {
includeInfo = Boolean.parseBoolean(items.get(0));
Expand Down
Expand Up @@ -85,7 +85,7 @@ public void load(ODatabaseDocumentInternal db) {
// RESTORE CALLBACK IF ANY
f.setCallback(callbacks.get(f.getName()));

functions.put(d.field("name").toString().toUpperCase(), f);
functions.put(d.field("name").toString().toUpperCase(Locale.ENGLISH), f);
}
}
}
Expand All @@ -95,7 +95,7 @@ public Set<String> getFunctionNames() {
}

public OFunction getFunction(final String iName) {
return functions.get(iName.toUpperCase());
return functions.get(iName.toUpperCase(Locale.ENGLISH));
}

public OFunction createFunction(final String iName) {
Expand All @@ -111,7 +111,7 @@ public synchronized OFunction createFunction(ODatabaseDocumentInternal database,
} catch (ORecordDuplicatedException ex) {
throw OException.wrapException(new OFunctionDuplicatedException("Function with name '" + iName + "' already exist"), null);
}
functions.put(iName.toUpperCase(), f);
functions.put(iName.toUpperCase(Locale.ENGLISH), f);

return f;
}
Expand Down Expand Up @@ -142,13 +142,13 @@ public synchronized void dropFunction(OFunction function) {
String name = function.getName();
ODocument doc = function.getDocument();
doc.delete();
functions.remove(name.toUpperCase());
functions.remove(name.toUpperCase(Locale.ENGLISH));
}

public synchronized void dropFunction(String iName) {
OFunction function = getFunction(iName);
ODocument doc = function.getDocument();
doc.delete();
functions.remove(iName.toUpperCase());
functions.remove(iName.toUpperCase(Locale.ENGLISH));
}
}
Expand Up @@ -1856,7 +1856,7 @@ public OIndex<?> createIndex(final String name, String type, final OProgressList
if (type == null)
throw new IllegalArgumentException("Index type is null");

type = type.toUpperCase();
type = type.toUpperCase(Locale.ENGLISH);

if (fields.length == 0) {
throw new OIndexException("List of fields to index cannot be empty.");
Expand Down
Expand Up @@ -28,6 +28,7 @@
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;

import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
Expand All @@ -53,7 +54,7 @@ public void load(final ODatabaseDocumentInternal db) {
document.reload();

final OSequence sequence = OSequenceHelper.createSequence(document);
sequences.put(sequence.getName().toUpperCase(), sequence);
sequences.put(sequence.getName().toUpperCase(Locale.ENGLISH), sequence);
}
}
}
Expand All @@ -71,7 +72,7 @@ public int getSequenceCount() {
}

public OSequence getSequence(final ODatabaseDocumentInternal database, final String iName) {
final String name = iName.toUpperCase();
final String name = iName.toUpperCase(Locale.ENGLISH);

OSequence seq = sequences.get(name);
if (seq == null) {
Expand All @@ -91,7 +92,7 @@ public OSequence createSequence(final ODatabaseDocumentInternal database, final
final OSequence.CreateParams params) {
init(database);

final String key = iName.toUpperCase();
final String key = iName.toUpperCase(Locale.ENGLISH);
validateSequenceNoExists(key);

final OSequence sequence = OSequenceHelper.createSequence(sequenceType, params, null).setName(iName);
Expand All @@ -106,7 +107,7 @@ public void dropSequence(final ODatabaseDocumentInternal database, final String

if (seq != null) {
database.delete(seq.getDocument().getIdentity());
sequences.remove(iName.toUpperCase());
sequences.remove(iName.toUpperCase(Locale.ENGLISH));
}
}

Expand All @@ -117,7 +118,7 @@ public OSequence onSequenceCreated(final ODatabaseDocumentInternal database, fin
if (name == null)
return null;

name = name.toUpperCase();
name = name.toUpperCase(Locale.ENGLISH);

final OSequence seq = getSequence(database, name);

Expand All @@ -135,7 +136,7 @@ public OSequence onSequenceUpdated(final ODatabaseDocumentInternal database, fin
if (name == null)
return null;

name = name.toUpperCase();
name = name.toUpperCase(Locale.ENGLISH);

final OSequence sequence = sequences.get(name);
if (sequence == null)
Expand All @@ -151,7 +152,7 @@ public void onSequenceDropped(final ODatabaseDocumentInternal database, final OD
if (name == null)
return;

name = name.toUpperCase();
name = name.toUpperCase(Locale.ENGLISH);

sequences.remove(name);
}
Expand Down

0 comments on commit 9f70834

Please sign in to comment.