Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
- id: check-json
- id: check-xml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v3.0.0-alpha.4
hooks:
- id: prettier
types: [ java ]
Expand Down
8 changes: 4 additions & 4 deletions console/src/main/java/com/arcadedb/console/Console.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private boolean execute(final String line) throws IOException {
if (lineTrimmed.isEmpty() || lineTrimmed.startsWith("--"))
return true;

final String lineLowerCase = lineTrimmed.toLowerCase();
final String lineLowerCase = lineTrimmed.toLowerCase(Locale.ENGLISH);

if (lineLowerCase.equals("quit") || lineLowerCase.equals("exit")) {
executeClose();
Expand Down Expand Up @@ -411,7 +411,7 @@ private void executeConnect(final String url) {

ComponentFile.MODE mode = ComponentFile.MODE.READ_WRITE;
if (urlParts.length > 1)
mode = ComponentFile.MODE.valueOf(urlParts[1].toUpperCase());
mode = ComponentFile.MODE.valueOf(urlParts[1].toUpperCase(Locale.ENGLISH));

databaseFactory = new DatabaseFactory(localUrl);
databaseProxy = databaseFactory.setAutoTransaction(true).open(mode);
Expand Down Expand Up @@ -451,7 +451,7 @@ private void executeCreateDatabase(final String url) {
private void executeCreateUser(final String params) {
checkRemoteDatabaseIsConnected();

final String paramsUpperCase = params.toUpperCase();
final String paramsUpperCase = params.toUpperCase(Locale.ENGLISH);

final int identifiedByPos = paramsUpperCase.indexOf("IDENTIFIED BY");
if (identifiedByPos < 0)
Expand Down Expand Up @@ -808,7 +808,7 @@ else if (subject.startsWith("type ")) {

final Result result = typeResult.next();

outputLine(0, result.getProperty("type").toString().toUpperCase() + " TYPE '" + typeName + "'\n");
outputLine(0, result.getProperty("type").toString().toUpperCase(Locale.ENGLISH) + " TYPE '" + typeName + "'\n");
outputLine(0, "Super types.......: " + result.getProperty("parentTypes"));
outputLine(0, "Buckets...........: " + result.getProperty("buckets"));
outputLine(0, "Bucket selection..: " + result.getProperty("bucketSelectionStrategy"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public <T extends Enum<T>> T getValueAsEnum(final GlobalConfiguration config, fi
if (enumType.isAssignableFrom(value.getClass())) {
return enumType.cast(value);
} else if (value instanceof String) {
final String presentation = value.toString().toUpperCase();
final String presentation = value.toString().toUpperCase(Locale.ENGLISH);
return Enum.valueOf(enumType, presentation);
} else {
throw new ClassCastException("Value " + value + " can not be cast to enumeration " + enumType.getSimpleName());
Expand Down
4 changes: 2 additions & 2 deletions engine/src/main/java/com/arcadedb/GlobalConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public Object call(final Object value) {

HA_CLUSTER_NAME("arcadedb.ha.clusterName", SCOPE.SERVER,
"Cluster name. By default is 'arcadedb'. Useful in case of multiple clusters in the same network", String.class,
Constants.PRODUCT.toLowerCase()),
Constants.PRODUCT.toLowerCase(Locale.ENGLISH)),

HA_SERVER_LIST("arcadedb.ha.serverList", SCOPE.SERVER,
"Servers in the cluster as a list of <hostname/ip-address:port> items separated by comma. Example: localhost:2424,192.168.0.1:2424",
Expand Down Expand Up @@ -695,7 +695,7 @@ else if (type.isEnum()) {
}

if (allowed != null && value != null)
if (!allowed.contains(value.toString().toLowerCase()))
if (!allowed.contains(value.toString().toLowerCase(Locale.ENGLISH)))
throw new IllegalArgumentException(
"Global setting '" + key + "=" + value + "' is not valid. Allowed values are " + allowed);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ public class DistanceFunctionFactory {
}

public static DistanceFunction getImplementationByName(final String name) {
return implementationsByName.get(name.toLowerCase());
return implementationsByName.get(name.toLowerCase(Locale.ENGLISH));
}

public static DistanceFunction getImplementationByClassName(final String name) {
return implementationsByClassName.get(name);
}

public static void registerImplementation(final String name, final DistanceFunction impl) {
implementationsByName.put(name.toLowerCase(), impl);
implementationsByName.put(name.toLowerCase(Locale.ENGLISH), impl);
implementationsByClassName.put(impl.getClass().getSimpleName(), impl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public void register(final String className) {
}

public void register(final QueryEngine.QueryEngineFactory impl) {
implementations.put(impl.getLanguage().toLowerCase(), impl);
implementations.put(impl.getLanguage().toLowerCase(Locale.ENGLISH), impl);
}

public QueryEngine getInstance(final String language, final DatabaseInternal database) {
final QueryEngine.QueryEngineFactory impl = implementations.get(language.toLowerCase());
final QueryEngine.QueryEngineFactory impl = implementations.get(language.toLowerCase(Locale.ENGLISH));
if (impl == null)
throw new IllegalArgumentException("Query engine '" + language + "' was not found. Check your configuration");
return impl.getInstance(database);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Object eval(final Document record, final Object left, final Object right) {
ilike("ilike", false, 1) {
@Override
Object eval(final Document record, final Object left, final Object right) {
return QueryHelper.like(((String) SelectExecutor.evaluateValue(record, left)).toLowerCase(),
return QueryHelper.like(((String) SelectExecutor.evaluateValue(record, left)).toLowerCase(Locale.ENGLISH),
((String) SelectExecutor.evaluateValue(record, right)).toLowerCase());
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import com.arcadedb.exception.CommandExecutionException;
import com.arcadedb.exception.TimeoutException;

import java.util.*;

/**
* Created by luigidellaquila on 20/02/17.
*/
Expand Down Expand Up @@ -82,7 +84,7 @@ public void close() {

@Override
public String prettyPrint(final int depth, final int indent) {
String result = ExecutionStepInternal.getIndent(depth, indent) + "+ CAST TO " + clsName.toUpperCase();
String result = ExecutionStepInternal.getIndent(depth, indent) + "+ CAST TO " + clsName.toUpperCase(Locale.ENGLISH);
if (profilingEnabled) {
result += " (" + getCostFormatted() + ")";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public String prettyPrint(final int depth, final int indent) {
}

private Object convertValue(final String key, Object value) {
if (key.toLowerCase().contains("password"))
if (key.toLowerCase(Locale.ENGLISH).contains("password"))
// MASK SENSITIVE DATA
value = "*****";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void register(final String iName, final Object iImplementation) {

@Override
public SQLMethod createMethod(final String name) throws CommandExecutionException {
final Object m = methods.get(name.toLowerCase());
final Object m = methods.get(name.toLowerCase(Locale.ENGLISH));
final SQLMethod method;

if (m instanceof Class<?>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public Object execute(final Object iThis, final Identifiable iCurrentRecord, fin
return ioResult != null ? Pattern.compile("\\b(.)(.*?)\\b")
.matcher(ioResult.toString())
.replaceAll(match -> match.group(1).toUpperCase(Locale.ENGLISH) +
match.group(2).toLowerCase())
match.group(2).toLowerCase(Locale.ENGLISH))
: null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import com.arcadedb.query.sql.executor.CommandContext;
import com.arcadedb.query.sql.method.AbstractSQLMethod;

import java.util.*;

/**
* @author Johann Sorel (Geomatys)
* @author Luca Garulli (l.garulli--(at)--gmail.com)
Expand All @@ -36,6 +38,6 @@ public SQLMethodToLowerCase() {

@Override
public Object execute(final Object iThis, final Identifiable iCurrentRecord, final CommandContext iContext, final Object ioResult, final Object[] iParams) {
return ioResult != null ? ioResult.toString().toLowerCase() : null;
return ioResult != null ? ioResult.toString().toLowerCase(Locale.ENGLISH) : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public ResultSet executeDDL(final CommandContext context) {
result.setProperty("oldValue", oldValue);
result.setProperty("newValue", finalValue);
} else if (settingName != null) {
final String setting = settingName.getStringValue().toLowerCase();
final String setting = settingName.getStringValue().toLowerCase(Locale.ENGLISH);
final Object finalValue = settingValue.execute((Identifiable) null, context);

final Object oldValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public ResultSet executeDDL(final CommandContext context) {
final ResultInternal result = new ResultInternal();

if (property != null) {
switch (property.toLowerCase()) {
switch (property.toLowerCase(Locale.ENGLISH)) {
case "bucket":
for (int i = 0; i < identifierListValue.size(); i++) {
final Identifier identifierValue = identifierListValue.get(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public BeginStatement(final int id) {
@Override
public ResultSet executeSimple(final CommandContext context) {
if (isolation != null)
context.getDatabase().begin(Database.TRANSACTION_ISOLATION_LEVEL.valueOf(isolation.getStringValue().toUpperCase()));
context.getDatabase().begin(Database.TRANSACTION_ISOLATION_LEVEL.valueOf(isolation.getStringValue().toUpperCase(Locale.ENGLISH)));
else
// USE THE STANDARD ISOLATION LEVEL
context.getDatabase().begin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import com.arcadedb.query.sql.executor.MultiValue;
import com.arcadedb.query.sql.executor.QueryHelper;

import java.util.*;

public class ILikeOperator extends SimpleNode implements BinaryCompareOperator {
public ILikeOperator(final int id) {
super(id);
Expand All @@ -37,7 +39,7 @@ public boolean execute(final DatabaseInternal database, final Object iLeft, fina
if (iLeft == null || iRight == null) {
return false;
}
return QueryHelper.like(iLeft.toString().toLowerCase(), iRight.toString().toLowerCase());
return QueryHelper.like(iLeft.toString().toLowerCase(Locale.ENGLISH), iRight.toString().toLowerCase(Locale.ENGLISH));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private Object execute(final Object targetObjects, final CommandContext context,
}

public Object executeReverse(final Object targetObjects, final CommandContext context) {
final String straightName = methodName.getStringValue().toLowerCase();
final String straightName = methodName.getStringValue().toLowerCase(Locale.ENGLISH);
final String inverseMethodName = bidirectionalMethods.get(straightName);

if (inverseMethodName != null)
Expand Down
2 changes: 1 addition & 1 deletion engine/src/main/java/com/arcadedb/schema/Property.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public Property setOfType(String ofType) {
if (changed) {
if (type == Type.LIST || type == Type.MAP) {
if (Type.getTypeByName(ofType) != null) {
ofType = ofType.toUpperCase();
ofType = ofType.toUpperCase(Locale.ENGLISH);
} else {
if (!owner.schema.existsType(ofType))
throw new SchemaException("Type '" + ofType + "' not defined");
Expand Down
6 changes: 3 additions & 3 deletions engine/src/main/java/com/arcadedb/schema/Type.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public enum Type {
static {
for (final Type type : values()) {
TYPES_BY_ID[type.id] = type;
TYPES_BY_NAME.put(type.name.toLowerCase(), type);
TYPES_BY_NAME.put(type.name.toLowerCase(Locale.ENGLISH), type);
}

// This is made by hand because not all types should be add.
Expand Down Expand Up @@ -175,7 +175,7 @@ public enum Type {

Type(final String iName, final int iId, final byte binaryType, final Class<?> iJavaDefaultType,
final Class<?>[] iAllowAssignmentBy) {
this.name = iName.toUpperCase();
this.name = iName.toUpperCase(Locale.ENGLISH);
this.id = iId;
this.binaryType = binaryType;
this.javaDefaultType = iJavaDefaultType;
Expand Down Expand Up @@ -280,7 +280,7 @@ public static Type getTypeByValue(final Object value) {
}

public static Type getTypeByName(final String name) {
return TYPES_BY_NAME.get(name.toLowerCase());
return TYPES_BY_NAME.get(name.toLowerCase(Locale.ENGLISH));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion engine/src/main/java/com/arcadedb/utility/AnsiCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static boolean supportsColors() {
SUPPORTS_COLORS = true;
else if ("auto".equalsIgnoreCase(ansiSupport)) {
// AUTOMATIC CHECK
SUPPORTS_COLORS = System.console() != null && !System.getProperty("os.name").toLowerCase().contains("win");
SUPPORTS_COLORS = System.console() != null && !System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win");
} else
// DO NOT SUPPORT ANSI
SUPPORTS_COLORS = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private ResultSet executeQuery(final OperationDefinition op) {

private GraphQLResultSet parseNativeQueryDirective(final String language, final Directive directive, final Selection selection, final ObjectTypeDefinition returnType) {
if (directive.getArguments() == null)
throw new CommandParsingException(language.toUpperCase() + " directive has no `statement` argument");
throw new CommandParsingException(language.toUpperCase(Locale.ENGLISH) + " directive has no `statement` argument");

String statement = null;
Map<String, Object> arguments = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ else if (rec instanceof com.arcadedb.graph.Edge)
}

public String toString() {
return StringFactory.stepString(this, this.returnClass.getSimpleName().toLowerCase(), indexCursors);
return StringFactory.stepString(this, this.returnClass.getSimpleName().toLowerCase(Locale.ENGLISH), indexCursors);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public E next() {
}

public String toString() {
return StringFactory.stepString(this, this.returnClass.getSimpleName().toLowerCase(), typeName);
return StringFactory.stepString(this, this.returnClass.getSimpleName().toLowerCase(Locale.ENGLISH), typeName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected void closeDatabase() {
}

protected AbstractBackupFormat createFormatImplementation() {
switch (settings.format.toLowerCase()) {
switch (settings.format.toLowerCase(Locale.ENGLISH)) {
case "full":
return new FullBackupFormat(database, settings, logger);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void validateSettings() {
public int parseParameter(final String name, final String value) {
if ("format".equals(name)) {
if (value != null)
format = value.toLowerCase();
format = value.toLowerCase(Locale.ENGLISH);
} else if ("dir".equals(name)) {
if (value != null)
directory = value.endsWith(File.separator) ? value : value + File.separator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ protected void closeDatabase() {
}

protected AbstractExporterFormat createFormatImplementation() {
switch (settings.format.toLowerCase()) {
switch (settings.format.toLowerCase(Locale.ENGLISH)) {
case JsonlExporterFormat.NAME:
return new JsonlExporterFormat(database, settings, context, logger);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public int parseParameter(String name, final String value) {
name = FileUtils.getStringContent(name);

if ("format".equals(name))
format = value.toLowerCase();
format = value.toLowerCase(Locale.ENGLISH);
else if ("f".equals(name) || "file".equals(name))
file = value;
else if ("d".equals(name))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ else if (state.equals("inputFile"))
else if (state.equals("batchSize"))
batchSize = Integer.parseInt(arg);
else if (state.equals("decimalType"))
typeForDecimals = Type.valueOf(arg.toUpperCase());
typeForDecimals = Type.valueOf(arg.toUpperCase(Locale.ENGLISH));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ else if (expectedVertices > Integer.MAX_VALUE)

try {
context.graphImporter = new GraphImporter((DatabaseInternal) database, (int) expectedVertices, (int) settings.expectedEdges,
Type.valueOf(settings.typeIdType.toUpperCase()));
Type.valueOf(settings.typeIdType.toUpperCase(Locale.ENGLISH)));
} catch (ClassNotFoundException e) {
throw new ImportException("Error on creating internal component", e);
}
Expand Down Expand Up @@ -315,7 +315,7 @@ private void loadEdges(final SourceSchema sourceSchema, final Parser parser, fin

try {
if (context.graphImporter == null)
context.graphImporter = new GraphImporter(database, (int) expectedVertices, (int) expectedEdges, Type.valueOf(settings.typeIdType.toUpperCase()));
context.graphImporter = new GraphImporter(database, (int) expectedVertices, (int) expectedEdges, Type.valueOf(settings.typeIdType.toUpperCase(Locale.ENGLISH)));
} catch (ClassNotFoundException e) {
throw new ImportException("Error on creating internal component", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ private Document createRecord(final Database database, final ImporterContext con

Type propType = Type.getTypeByValue(idValue);
if (mapping.has("@idType"))
propType = Type.getTypeByName(mapping.getString("@idType").toUpperCase());
propType = Type.getTypeByName(mapping.getString("@idType").toUpperCase(Locale.ENGLISH));

prop = type.createProperty(id, propType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public TextEmbeddingsImporter(final DatabaseInternal database, final InputStream

if (settings.options.containsKey("distanceFunction")) {
this.distanceFunctionName = settings.options.get("distanceFunction");
this.distanceFunctionName = Character.toUpperCase(this.distanceFunctionName.charAt(0)) + this.distanceFunctionName.substring(1).toLowerCase();
this.distanceFunctionName = Character.toUpperCase(this.distanceFunctionName.charAt(0)) + this.distanceFunctionName.substring(1).toLowerCase(Locale.ENGLISH);
}

if (settings.options.containsKey("vectorType")) {
this.vectorTypeName = settings.options.get("vectorType");
// USE CAMEL CASE FOR THE VECTOR TYPE
this.vectorTypeName = Character.toUpperCase(this.vectorTypeName.charAt(0)) + this.vectorTypeName.substring(1).toLowerCase();
this.vectorTypeName = Character.toUpperCase(this.vectorTypeName.charAt(0)) + this.vectorTypeName.substring(1).toLowerCase(Locale.ENGLISH);
}

if (settings.options.containsKey("vectorProperty"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Restore setVerboseLevel(final int verboseLevel) {
}

protected AbstractRestoreFormat createFormatImplementation() {
switch (settings.format.toLowerCase()) {
switch (settings.format.toLowerCase(Locale.ENGLISH)) {
case "full":
return new FullRestoreFormat(database, settings, logger);

Expand Down
Loading