HHH-9722
Changed all toLowerCase() and toUpperCase() to toLowerCase(Locale.ROOT), toUpperCase(Locale.ROOT).
This commit is contained in:
parent
f0029d49bc
commit
1361925bc7
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
package org.hibernate;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Controls how the session interacts with the second-level cache and query cache.
|
||||
*
|
||||
|
@ -100,7 +102,7 @@ public enum CacheMode {
|
|||
}
|
||||
|
||||
try {
|
||||
return CacheMode.valueOf( setting.toUpperCase() );
|
||||
return CacheMode.valueOf( setting.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
catch ( IllegalArgumentException e ) {
|
||||
throw new MappingException( "Unknown Cache Mode: " + setting );
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
package org.hibernate;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Defines the various policies by which Hibernate might release its underlying
|
||||
* JDBC connection.
|
||||
|
@ -61,6 +63,6 @@ public enum ConnectionReleaseMode{
|
|||
* @return The matched enum value.
|
||||
*/
|
||||
public static ConnectionReleaseMode parse(final String name) {
|
||||
return ConnectionReleaseMode.valueOf( name.toUpperCase() );
|
||||
return ConnectionReleaseMode.valueOf( name.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
package org.hibernate;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Represents a flushing strategy. The flush process synchronizes
|
||||
* database state with session state by detecting state changes
|
||||
|
@ -119,7 +121,7 @@ public enum FlushMode {
|
|||
}
|
||||
|
||||
try {
|
||||
return FlushMode.valueOf( externalName.toUpperCase() );
|
||||
return FlushMode.valueOf( externalName.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
catch ( IllegalArgumentException e ) {
|
||||
throw new MappingException( "unknown FlushMode : " + externalName );
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.cfg.Environment;
|
||||
|
@ -88,7 +89,7 @@ public enum MultiTenancyStrategy {
|
|||
|
||||
final String strategyName = strategy.toString();
|
||||
try {
|
||||
return MultiTenancyStrategy.valueOf( strategyName.toUpperCase() );
|
||||
return MultiTenancyStrategy.valueOf( strategyName.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
catch ( RuntimeException e ) {
|
||||
LOG.warn( "Unknown multi tenancy strategy [ " +strategyName +" ], using MultiTenancyStrategy.NONE." );
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.SharedCacheMode;
|
||||
|
@ -339,7 +340,7 @@ public class MetadataBuilderImpl implements MetadataBuilder, TypeContributions {
|
|||
|
||||
// HHH-7721: SQLFunctionRegistry expects all lowercase. Enforce,
|
||||
// just in case a user's customer dialect uses mixed cases.
|
||||
this.options.sqlFunctionMap.put( functionName.toLowerCase(), function );
|
||||
this.options.sqlFunctionMap.put( functionName.toLowerCase(Locale.ROOT), function );
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -2500,7 +2500,7 @@ public class ModelBinder {
|
|||
String.format(
|
||||
Locale.ENGLISH,
|
||||
"Cannot specify both insert=\"true\" and generated=\"%s\" for property %s",
|
||||
generationTiming.name().toLowerCase(),
|
||||
generationTiming.name().toLowerCase(Locale.ROOT),
|
||||
propertySource.getName()
|
||||
),
|
||||
mappingDocument.getOrigin()
|
||||
|
@ -2522,7 +2522,7 @@ public class ModelBinder {
|
|||
String.format(
|
||||
Locale.ENGLISH,
|
||||
"Cannot specify both update=\"true\" and generated=\"%s\" for property %s",
|
||||
generationTiming.name().toLowerCase(),
|
||||
generationTiming.name().toLowerCase(Locale.ROOT),
|
||||
propertySource.getName()
|
||||
),
|
||||
mappingDocument.getOrigin()
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
package org.hibernate.boot.model.source.internal.hbm;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Provides meta-information about XML elements.
|
||||
*
|
||||
|
@ -173,7 +175,7 @@ public enum XmlElementMetadata {
|
|||
* @return The {@code hbm.xml} element name
|
||||
*/
|
||||
public String getElementName() {
|
||||
return name().toLowerCase();
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.hibernate.bytecode.enhance.spi.EnhancerConstants;
|
|||
|
||||
import javax.persistence.Id;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* utility class to generate interceptor methods
|
||||
|
@ -176,7 +177,7 @@ public abstract class AttributeTypeDescriptor {
|
|||
throw new IllegalArgumentException( "Primitive attribute type descriptor can only be used on primitive types" );
|
||||
}
|
||||
// capitalize first letter
|
||||
this.type = primitiveType.getSimpleName().substring( 0, 1 ).toUpperCase() + primitiveType.getSimpleName().substring( 1 );
|
||||
this.type = primitiveType.getSimpleName().substring( 0, 1 ).toUpperCase(Locale.ROOT) + primitiveType.getSimpleName().substring( 1 );
|
||||
}
|
||||
|
||||
public String buildReadInterceptionBodyFragment(String fieldName) {
|
||||
|
@ -197,7 +198,7 @@ public abstract class AttributeTypeDescriptor {
|
|||
"}%n" +
|
||||
"this.%1$s = localVar;",
|
||||
fieldName,
|
||||
type.toLowerCase(),
|
||||
type.toLowerCase(Locale.ROOT ),
|
||||
type,
|
||||
EnhancerConstants.INTERCEPTOR_GETTER_NAME
|
||||
);
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.cfg;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.AnnotationException;
|
||||
|
@ -88,7 +89,7 @@ public class CopyIdentifierComponentSecondPass implements SecondPass {
|
|||
break;
|
||||
}
|
||||
//JPA 2 requires referencedColumnNames to be case insensitive
|
||||
columnByReferencedName.put( referencedColumnName.toLowerCase(), joinColumn );
|
||||
columnByReferencedName.put( referencedColumnName.toLowerCase(Locale.ROOT), joinColumn );
|
||||
}
|
||||
//try default column orientation
|
||||
int index = 0;
|
||||
|
@ -146,7 +147,7 @@ public class CopyIdentifierComponentSecondPass implements SecondPass {
|
|||
columnName
|
||||
);
|
||||
//JPA 2 requires referencedColumnNames to be case insensitive
|
||||
joinColumn = columnByReferencedName.get( logicalColumnName.toLowerCase() );
|
||||
joinColumn = columnByReferencedName.get( logicalColumnName.toLowerCase(Locale.ROOT ) );
|
||||
}
|
||||
else {
|
||||
joinColumn = columnByReferencedName.get( "" + index );
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.cfg;
|
||||
import java.util.Locale;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class DefaultComponentSafeNamingStrategy extends EJB3NamingStrategy {
|
|||
public static final NamingStrategy INSTANCE = new DefaultComponentSafeNamingStrategy();
|
||||
|
||||
protected static String addUnderscores(String name) {
|
||||
return name.replace( '.', '_' ).toLowerCase();
|
||||
return name.replace( '.', '_' ).toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.cfg;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
@ -79,7 +80,7 @@ public class ImprovedNamingStrategy implements NamingStrategy, Serializable {
|
|||
buf.insert(i++, '_');
|
||||
}
|
||||
}
|
||||
return buf.toString().toLowerCase();
|
||||
return buf.toString().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public String collectionTableName(
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.cfg;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.persistence.Index;
|
||||
|
||||
|
@ -69,7 +70,7 @@ public class JPAIndexHolder {
|
|||
private void initializeColumns(String[] columns, String[] ordering, List<String> list) {
|
||||
for ( int i = 0, size = list.size(); i < size; i++ ) {
|
||||
final String description = list.get( i );
|
||||
final String tmp = description.toLowerCase();
|
||||
final String tmp = description.toLowerCase(Locale.ROOT);
|
||||
if ( tmp.endsWith( " desc" ) ) {
|
||||
columns[i] = description.substring( 0, description.length() - 5 );
|
||||
ordering[i] = "desc";
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.cfg;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
|
@ -66,7 +67,7 @@ public class VerifyFetchProfileReferenceSecondPass implements SecondPass {
|
|||
clazz.getProperty( fetch.association() );
|
||||
|
||||
profile.addFetch(
|
||||
fetch.entity().getName(), fetch.association(), fetch.mode().toString().toLowerCase()
|
||||
fetch.entity().getName(), fetch.association(), fetch.mode().toString().toLowerCase(Locale.ROOT)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ package org.hibernate.cfg.annotations;
|
|||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import javax.persistence.AttributeOverride;
|
||||
|
@ -463,23 +464,23 @@ public abstract class CollectionBinder {
|
|||
Loader loader = property.getAnnotation( Loader.class );
|
||||
if ( sqlInsert != null ) {
|
||||
collection.setCustomSQLInsert( sqlInsert.sql().trim(), sqlInsert.callable(),
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlInsert.check().toString().toLowerCase() )
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlInsert.check().toString().toLowerCase(Locale.ROOT) )
|
||||
);
|
||||
|
||||
}
|
||||
if ( sqlUpdate != null ) {
|
||||
collection.setCustomSQLUpdate( sqlUpdate.sql(), sqlUpdate.callable(),
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlUpdate.check().toString().toLowerCase() )
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlUpdate.check().toString().toLowerCase(Locale.ROOT) )
|
||||
);
|
||||
}
|
||||
if ( sqlDelete != null ) {
|
||||
collection.setCustomSQLDelete( sqlDelete.sql(), sqlDelete.callable(),
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDelete.check().toString().toLowerCase() )
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDelete.check().toString().toLowerCase(Locale.ROOT) )
|
||||
);
|
||||
}
|
||||
if ( sqlDeleteAll != null ) {
|
||||
collection.setCustomSQLDeleteAll( sqlDeleteAll.sql(), sqlDeleteAll.callable(),
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDeleteAll.check().toString().toLowerCase() )
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDeleteAll.check().toString().toLowerCase(Locale.ROOT) )
|
||||
);
|
||||
}
|
||||
if ( loader != null ) {
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import javax.persistence.Access;
|
||||
import javax.persistence.ConstraintMode;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -334,23 +335,23 @@ public class EntityBinder {
|
|||
|
||||
if ( sqlInsert != null ) {
|
||||
persistentClass.setCustomSQLInsert( sqlInsert.sql().trim(), sqlInsert.callable(),
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlInsert.check().toString().toLowerCase() )
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlInsert.check().toString().toLowerCase(Locale.ROOT) )
|
||||
);
|
||||
|
||||
}
|
||||
if ( sqlUpdate != null ) {
|
||||
persistentClass.setCustomSQLUpdate( sqlUpdate.sql(), sqlUpdate.callable(),
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlUpdate.check().toString().toLowerCase() )
|
||||
);
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlUpdate.check().toString().toLowerCase(Locale.ROOT) )
|
||||
);Locale.ROOT
|
||||
}
|
||||
if ( sqlDelete != null ) {
|
||||
persistentClass.setCustomSQLDelete( sqlDelete.sql(), sqlDelete.callable(),
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDelete.check().toString().toLowerCase() )
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDelete.check().toString().toLowerCase(Locale.ROOT) )
|
||||
);
|
||||
}
|
||||
if ( sqlDeleteAll != null ) {
|
||||
persistentClass.setCustomSQLDelete( sqlDeleteAll.sql(), sqlDeleteAll.callable(),
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDeleteAll.check().toString().toLowerCase() )
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName( sqlDeleteAll.check().toString().toLowerCase(Locale.ROOT) )
|
||||
);
|
||||
}
|
||||
if ( loader != null ) {
|
||||
|
@ -986,7 +987,7 @@ public class EntityBinder {
|
|||
join.setCustomSQLInsert( matchingTable.sqlInsert().sql().trim(),
|
||||
matchingTable.sqlInsert().callable(),
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName(
|
||||
matchingTable.sqlInsert().check().toString().toLowerCase()
|
||||
matchingTable.sqlInsert().check().toString().toLowerCase(Locale.ROOT)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -994,7 +995,7 @@ public class EntityBinder {
|
|||
join.setCustomSQLUpdate( matchingTable.sqlUpdate().sql().trim(),
|
||||
matchingTable.sqlUpdate().callable(),
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName(
|
||||
matchingTable.sqlUpdate().check().toString().toLowerCase()
|
||||
matchingTable.sqlUpdate().check().toString().toLowerCase(Locale.ROOT)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -1002,7 +1003,7 @@ public class EntityBinder {
|
|||
join.setCustomSQLDelete( matchingTable.sqlDelete().sql().trim(),
|
||||
matchingTable.sqlDelete().callable(),
|
||||
ExecuteUpdateResultCheckStyle.fromExternalName(
|
||||
matchingTable.sqlDelete().check().toString().toLowerCase()
|
||||
matchingTable.sqlDelete().check().toString().toLowerCase(Locale.ROOT)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.persistence.Access;
|
||||
|
@ -1980,7 +1981,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
parameterDescriptor.setValue( "mode", ParameterMode.IN );
|
||||
}
|
||||
else {
|
||||
parameterDescriptor.setValue( "mode", ParameterMode.valueOf( modeValue.toUpperCase() ) );
|
||||
parameterDescriptor.setValue( "mode", ParameterMode.valueOf( modeValue.toUpperCase(Locale.ROOT) ) );
|
||||
}
|
||||
String clazzName = parameterElement.attributeValue( "class" );
|
||||
Class clazz;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.cfg.beanvalidation;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
|
@ -68,7 +69,7 @@ public enum ValidationMode {
|
|||
}
|
||||
else {
|
||||
try {
|
||||
return valueOf( modeProperty.trim().toUpperCase() );
|
||||
return valueOf( modeProperty.trim().toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
catch ( IllegalArgumentException e ) {
|
||||
throw new HibernateException( "Unknown validation mode in " + BeanValidationIntegrator.MODE_PROPERTY + ": " + modeProperty );
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
|
@ -289,7 +290,7 @@ public class Example implements Criterion {
|
|||
if ( value instanceof String ) {
|
||||
String string = (String) value;
|
||||
if ( isIgnoreCaseEnabled ) {
|
||||
string = string.toLowerCase();
|
||||
string = string.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
if ( isLikeEnabled ) {
|
||||
string = matchMode.toMatchString( string );
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
package org.hibernate.criterion;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
|
@ -74,7 +75,7 @@ public class IlikeExpression implements Criterion {
|
|||
criteriaQuery.getTypedValue(
|
||||
criteria,
|
||||
propertyName,
|
||||
value.toString().toLowerCase()
|
||||
value.toString().toLowerCase(Locale.ROOT)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.HibernateException;
|
||||
|
@ -132,7 +133,7 @@ public class Junction implements Criterion {
|
|||
* @return SQL operator
|
||||
*/
|
||||
public String getOperator() {
|
||||
return name().toLowerCase();
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.criterion;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
|
@ -94,7 +95,7 @@ public class LikeExpression implements Criterion {
|
|||
|
||||
@Override
|
||||
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) {
|
||||
final String matchValue = ignoreCase ? value.toString().toLowerCase() : value.toString();
|
||||
final String matchValue = ignoreCase ? value.toString().toLowerCase(Locale.ROOT) : value.toString();
|
||||
|
||||
return new TypedValue[] { criteriaQuery.getTypedValue( criteria, propertyName, matchValue ) };
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.criterion;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.NullPrecedence;
|
||||
|
@ -167,6 +168,6 @@ public class Order implements Serializable {
|
|||
public String toString() {
|
||||
return propertyName + ' '
|
||||
+ ( ascending ? "asc" : "desc" )
|
||||
+ ( nullPrecedence != null ? ' ' + nullPrecedence.name().toLowerCase() : "" );
|
||||
+ ( nullPrecedence != null ? ' ' + nullPrecedence.name().toLowerCase(Locale.ROOT) : "" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.criterion;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.HibernateException;
|
||||
|
@ -111,7 +112,7 @@ public class SimpleExpression implements Criterion {
|
|||
|
||||
@Override
|
||||
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
|
||||
final Object casedValue = ignoreCase ? value.toString().toLowerCase() : value;
|
||||
final Object casedValue = ignoreCase ? value.toString().toLowerCase(Locale.ROOT) : value;
|
||||
return new TypedValue[] { criteriaQuery.getTypedValue( criteria, propertyName, casedValue ) };
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.dialect;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.dialect.function.AnsiTrimFunction;
|
||||
|
@ -198,7 +199,7 @@ public class DerbyDialect extends DB2Dialect {
|
|||
@Override
|
||||
public String getLimitString(String query, final int offset, final int limit) {
|
||||
final StringBuilder sb = new StringBuilder(query.length() + 50);
|
||||
final String normalizedSelect = query.toLowerCase().trim();
|
||||
final String normalizedSelect = query.toLowerCase(Locale.ROOT).trim();
|
||||
final int forUpdateIndex = normalizedSelect.lastIndexOf( "for update") ;
|
||||
|
||||
if ( hasForUpdateClause( forUpdateIndex ) ) {
|
||||
|
@ -287,7 +288,7 @@ public class DerbyDialect extends DB2Dialect {
|
|||
@Override
|
||||
public String processSql(String sql, RowSelection selection) {
|
||||
final StringBuilder sb = new StringBuilder( sql.length() + 50 );
|
||||
final String normalizedSelect = sql.toLowerCase().trim();
|
||||
final String normalizedSelect = sql.toLowerCase(Locale.ROOT).trim();
|
||||
final int forUpdateIndex = normalizedSelect.lastIndexOf( "for update" );
|
||||
|
||||
if (hasForUpdateClause( forUpdateIndex )) {
|
||||
|
|
|
@ -109,6 +109,7 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
@ -710,7 +711,7 @@ public abstract class Dialect implements ConversionContext {
|
|||
protected void registerFunction(String name, SQLFunction function) {
|
||||
// HHH-7721: SQLFunctionRegistry expects all lowercase. Enforce,
|
||||
// just in case a user's customer dialect uses mixed cases.
|
||||
sqlFunctions.put( name.toLowerCase(), function );
|
||||
sqlFunctions.put( name.toLowerCase(Locale.ROOT), function );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2452,7 +2453,7 @@ public abstract class Dialect implements ConversionContext {
|
|||
orderByElement.append( " " ).append( order );
|
||||
}
|
||||
if ( nulls != NullPrecedence.NONE ) {
|
||||
orderByElement.append( " nulls " ).append( nulls.name().toLowerCase() );
|
||||
orderByElement.append( " nulls " ).append( nulls.name().toLowerCase(Locale.ROOT) );
|
||||
}
|
||||
return orderByElement.toString();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ package org.hibernate.dialect;
|
|||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
|
@ -86,7 +87,7 @@ public class HSQLDialect extends Dialect {
|
|||
return new StringBuilder( sql.length() + 10 )
|
||||
.append( sql )
|
||||
.insert(
|
||||
sql.toLowerCase().indexOf( "select" ) + 6,
|
||||
sql.toLowerCase(Locale.ROOT).indexOf( "select" ) + 6,
|
||||
hasOffset ? " limit ? ?" : " top ?"
|
||||
)
|
||||
.toString();
|
||||
|
@ -319,7 +320,7 @@ public class HSQLDialect extends Dialect {
|
|||
return new StringBuilder( sql.length() + 10 )
|
||||
.append( sql )
|
||||
.insert(
|
||||
sql.toLowerCase().indexOf( "select" ) + 6,
|
||||
sql.toLowerCase(Locale.ROOT).indexOf( "select" ) + 6,
|
||||
hasOffset ? " limit ? ?" : " top ?"
|
||||
)
|
||||
.toString();
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.dialect;
|
|||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.dialect.function.VarArgsSQLFunction;
|
||||
|
@ -219,7 +220,7 @@ public class InformixDialect extends Dialect {
|
|||
}
|
||||
return new StringBuilder( querySelect.length() + 8 )
|
||||
.append( querySelect )
|
||||
.insert( querySelect.toLowerCase().indexOf( "select" ) + 6, " first " + limit )
|
||||
.insert( querySelect.toLowerCase(Locale.ROOT).indexOf( "select" ) + 6, " first " + limit )
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.dialect;
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||
|
@ -105,7 +106,7 @@ public class InterbaseDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public String getDropSequenceString(String sequenceName) {
|
||||
return "delete from RDB$GENERATORS where RDB$GENERATOR_NAME = '" + sequenceName.toUpperCase() + "'";
|
||||
return "delete from RDB$GENERATORS where RDB$GENERATOR_NAME = '" + sequenceName.toUpperCase(Locale.ROOT) + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.QueryTimeoutException;
|
||||
|
@ -73,7 +74,8 @@ public class Oracle8iDialect extends Dialect {
|
|||
final boolean hasOffset = LimitHelper.hasFirstRow( selection );
|
||||
sql = sql.trim();
|
||||
boolean isForUpdate = false;
|
||||
if (sql.toLowerCase().endsWith( " for update" )) {
|
||||
if (sql.toLowerCase(Locale.ROOT
|
||||
).endsWith( " for update" )) {
|
||||
sql = sql.substring( 0, sql.length() - 11 );
|
||||
isForUpdate = true;
|
||||
}
|
||||
|
@ -306,7 +308,7 @@ public class Oracle8iDialect extends Dialect {
|
|||
public String getLimitString(String sql, boolean hasOffset) {
|
||||
sql = sql.trim();
|
||||
boolean isForUpdate = false;
|
||||
if ( sql.toLowerCase().endsWith( " for update" ) ) {
|
||||
if ( sql.toLowerCase(Locale.ROOT).endsWith( " for update" ) ) {
|
||||
sql = sql.substring( 0, sql.length()-11 );
|
||||
isForUpdate = true;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.sql.CallableStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||
|
@ -242,7 +243,7 @@ public class Oracle9Dialect extends Dialect {
|
|||
|
||||
sql = sql.trim();
|
||||
boolean isForUpdate = false;
|
||||
if ( sql.toLowerCase().endsWith( " for update" ) ) {
|
||||
if ( sql.toLowerCase(Locale.ROOT).endsWith( " for update" ) ) {
|
||||
sql = sql.substring( 0, sql.length() - 11 );
|
||||
isForUpdate = true;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.dialect;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.dialect.pagination.AbstractLimitHandler;
|
||||
|
@ -49,7 +50,7 @@ public class Oracle9iDialect extends Oracle8iDialect {
|
|||
sql = sql.trim();
|
||||
String forUpdateClause = null;
|
||||
boolean isForUpdate = false;
|
||||
final int forUpdateIndex = sql.toLowerCase().lastIndexOf( "for update" );
|
||||
final int forUpdateIndex = sql.toLowerCase(Locale.ROOT).lastIndexOf( "for update" );
|
||||
if (forUpdateIndex > -1) {
|
||||
// save 'for update ...' and then remove it
|
||||
forUpdateClause = sql.substring( forUpdateIndex );
|
||||
|
@ -126,7 +127,7 @@ public class Oracle9iDialect extends Oracle8iDialect {
|
|||
sql = sql.trim();
|
||||
String forUpdateClause = null;
|
||||
boolean isForUpdate = false;
|
||||
final int forUpdateIndex = sql.toLowerCase().lastIndexOf( "for update") ;
|
||||
final int forUpdateIndex = sql.toLowerCase(Locale.ROOT).lastIndexOf( "for update") ;
|
||||
if ( forUpdateIndex > -1 ) {
|
||||
// save 'for update ...' and then remove it
|
||||
forUpdateClause = sql.substring( forUpdateIndex );
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.dialect;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.sql.CaseFragment;
|
||||
|
@ -75,7 +76,7 @@ public class OracleDialect extends Oracle9Dialect {
|
|||
|
||||
sql = sql.trim();
|
||||
boolean isForUpdate = false;
|
||||
if ( sql.toLowerCase().endsWith( " for update" ) ) {
|
||||
if ( sql.toLowerCase(Locale.ROOT).endsWith( " for update" ) ) {
|
||||
sql = sql.substring( 0, sql.length()-11 );
|
||||
isForUpdate = true;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.dialect;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
|
@ -79,8 +80,8 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
|
|||
}
|
||||
|
||||
static int getAfterSelectInsertPoint(String sql) {
|
||||
final int selectIndex = sql.toLowerCase().indexOf( "select" );
|
||||
final int selectDistinctIndex = sql.toLowerCase().indexOf( "select distinct" );
|
||||
final int selectIndex = sql.toLowerCase(Locale.ROOT).indexOf( "select" );
|
||||
final int selectDistinctIndex = sql.toLowerCase(Locale.ROOT).indexOf( "select distinct" );
|
||||
return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.dialect.function;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
|
@ -59,7 +60,7 @@ public class SQLFunctionRegistry {
|
|||
* @return The located function, maye return {@code null}
|
||||
*/
|
||||
public SQLFunction findSQLFunction(String functionName) {
|
||||
final String name = functionName.toLowerCase();
|
||||
final String name = functionName.toLowerCase(Locale.ROOT);
|
||||
final SQLFunction userFunction = userFunctions.get( name );
|
||||
return userFunction != null
|
||||
? userFunction
|
||||
|
@ -75,7 +76,7 @@ public class SQLFunctionRegistry {
|
|||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public boolean hasFunction(String functionName) {
|
||||
final String name = functionName.toLowerCase();
|
||||
final String name = functionName.toLowerCase(Locale.ROOT);
|
||||
return userFunctions.containsKey( name ) || dialect.getFunctions().containsKey( name );
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
package org.hibernate.dialect.pagination;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.hibernate.engine.spi.RowSelection;
|
||||
|
||||
|
||||
|
@ -42,7 +43,7 @@ public class FirstLimitHandler extends AbstractLimitHandler {
|
|||
}
|
||||
return new StringBuilder( sql.length() + 16 )
|
||||
.append( sql )
|
||||
.insert( sql.toLowerCase().indexOf( "select" ) + 6, " first ?" )
|
||||
.insert( sql.toLowerCase(Locale.ROOT).indexOf( "select" ) + 6, " first ?" )
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.SQLException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -296,7 +297,7 @@ public class SQLServer2005LimitHandler extends AbstractLimitHandler {
|
|||
*/
|
||||
private static int shallowIndexOf(StringBuilder sb, String search, int fromIndex) {
|
||||
// case-insensitive match
|
||||
final String lowercase = sb.toString().toLowerCase();
|
||||
final String lowercase = sb.toString().toLowerCase(Locale.ROOT);
|
||||
final int len = lowercase.length();
|
||||
final int searchlen = search.length();
|
||||
int pos = -1;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
package org.hibernate.dialect.pagination;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.hibernate.engine.spi.RowSelection;
|
||||
|
||||
|
||||
|
@ -62,8 +63,8 @@ public class TopLimitHandler extends AbstractLimitHandler {
|
|||
throw new UnsupportedOperationException( "query result offset is not supported" );
|
||||
}
|
||||
|
||||
final int selectIndex = sql.toLowerCase().indexOf( "select" );
|
||||
final int selectDistinctIndex = sql.toLowerCase().indexOf( "select distinct" );
|
||||
final int selectIndex = sql.toLowerCase(Locale.ROOT).indexOf( "select" );
|
||||
final int selectDistinctIndex = sql.toLowerCase(Locale.ROOT).indexOf( "select distinct" );
|
||||
final int insertionPoint = selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
|
||||
|
||||
return new StringBuilder( sql.length() + 8 )
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.sql.SQLException;
|
|||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.engine.jdbc.cursor.internal.StandardRefCursorSupport;
|
||||
|
@ -214,7 +215,7 @@ public class ExtractedDatabaseMetaDataImpl implements ExtractedDatabaseMetaData
|
|||
private Set<String> parseKeywords(String extraKeywordsString) {
|
||||
final Set<String> keywordSet = new HashSet<String>();
|
||||
for ( String keyword : extraKeywordsString.split( "," ) ) {
|
||||
keywordSet.add( keyword.toUpperCase() );
|
||||
keywordSet.add( keyword.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
return keywordSet;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.sql.SQLException;
|
|||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.boot.model.naming.Identifier;
|
||||
|
@ -88,7 +89,7 @@ public class JdbcEnvironmentImpl implements JdbcEnvironment {
|
|||
this.extractedMetaDataSupport = new ExtractedDatabaseMetaDataImpl.Builder( this ).build();
|
||||
|
||||
for ( String keyword : dialect.getKeywords() ) {
|
||||
reservedWords.add( keyword.toUpperCase() );
|
||||
reservedWords.add( keyword.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
|
||||
final boolean globallyQuoteIdentifiers = serviceRegistry.getService( ConfigurationService.class )
|
||||
|
@ -142,7 +143,7 @@ public class JdbcEnvironmentImpl implements JdbcEnvironment {
|
|||
}
|
||||
|
||||
for ( String keyword : dialect.getKeywords() ) {
|
||||
reservedWords.add( keyword.toUpperCase() );
|
||||
reservedWords.add( keyword.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
// ExtractedMetaDataSupport already capitalizes them
|
||||
reservedWords.addAll( extractedMetaDataSupport.getExtraKeywords() );
|
||||
|
@ -219,7 +220,7 @@ public class JdbcEnvironmentImpl implements JdbcEnvironment {
|
|||
}
|
||||
|
||||
for ( String keyword : dialect.getKeywords() ) {
|
||||
reservedWords.add( keyword.toUpperCase() );
|
||||
reservedWords.add( keyword.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
// ExtractedMetaDataSupport already capitalizes them
|
||||
reservedWords.addAll( extractedMetaDataSupport.getExtraKeywords() );
|
||||
|
@ -335,7 +336,7 @@ public class JdbcEnvironmentImpl implements JdbcEnvironment {
|
|||
|
||||
@Override
|
||||
public boolean isReservedWord(String word) {
|
||||
return reservedWords.contains( word.toUpperCase() );
|
||||
return reservedWords.contains( word.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -228,8 +228,8 @@ public class NormalizingIdentifierHelperImpl implements IdentifierHelper {
|
|||
}
|
||||
|
||||
// lovely decipher of whether the incoming value represents a quoted identifier...
|
||||
final boolean isUpperCase = text.toUpperCase().equals( text );
|
||||
final boolean isLowerCase = text.toLowerCase().equals( text );
|
||||
final boolean isUpperCase = text.toUpperCase(Locale.ROOT).equals( text );
|
||||
final boolean isLowerCase = text.toLowerCase(Locale.ROOT).equals( text );
|
||||
final boolean isMixedCase = ! isLowerCase && ! isUpperCase;
|
||||
|
||||
if ( jdbcEnvironment.isReservedWord( text ) ) {
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.engine.jdbc.internal;
|
|||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
|
@ -126,7 +127,7 @@ public class BasicFormatterImpl implements Formatter {
|
|||
|
||||
while ( tokens.hasMoreTokens() ) {
|
||||
token = tokens.nextToken();
|
||||
lcToken = token.toLowerCase();
|
||||
lcToken = token.toLowerCase(Locale.ROOT);
|
||||
|
||||
if ( "'".equals( token ) ) {
|
||||
String t;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.engine.jdbc.internal;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
@ -44,13 +45,13 @@ public class DDLFormatterImpl implements Formatter {
|
|||
if ( StringHelper.isEmpty( sql ) ) {
|
||||
return sql;
|
||||
}
|
||||
if ( sql.toLowerCase().startsWith( "create table" ) ) {
|
||||
if ( sql.toLowerCase(Locale.ROOT).startsWith( "create table" ) ) {
|
||||
return formatCreateTable( sql );
|
||||
}
|
||||
else if ( sql.toLowerCase().startsWith( "alter table" ) ) {
|
||||
else if ( sql.toLowerCase(Locale.ROOT).startsWith( "alter table" ) ) {
|
||||
return formatAlterTable( sql );
|
||||
}
|
||||
else if ( sql.toLowerCase().startsWith( "comment on" ) ) {
|
||||
else if ( sql.toLowerCase(Locale.ROOT).startsWith( "comment on" ) ) {
|
||||
return formatCommentOn( sql );
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.hql.internal;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.persister.collection.CollectionPropertyNames;
|
||||
|
@ -36,17 +37,17 @@ import org.hibernate.persister.collection.CollectionPropertyNames;
|
|||
public final class CollectionProperties {
|
||||
public static final Map HQL_COLLECTION_PROPERTIES;
|
||||
|
||||
private static final String COLLECTION_INDEX_LOWER = CollectionPropertyNames.COLLECTION_INDEX.toLowerCase();
|
||||
private static final String COLLECTION_INDEX_LOWER = CollectionPropertyNames.COLLECTION_INDEX.toLowerCase(Locale.ROOT);
|
||||
|
||||
static {
|
||||
HQL_COLLECTION_PROPERTIES = new HashMap();
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_ELEMENTS.toLowerCase(), CollectionPropertyNames.COLLECTION_ELEMENTS );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_INDICES.toLowerCase(), CollectionPropertyNames.COLLECTION_INDICES );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_SIZE.toLowerCase(), CollectionPropertyNames.COLLECTION_SIZE );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MAX_INDEX.toLowerCase(), CollectionPropertyNames.COLLECTION_MAX_INDEX );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MIN_INDEX.toLowerCase(), CollectionPropertyNames.COLLECTION_MIN_INDEX );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MAX_ELEMENT.toLowerCase(), CollectionPropertyNames.COLLECTION_MAX_ELEMENT );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MIN_ELEMENT.toLowerCase(), CollectionPropertyNames.COLLECTION_MIN_ELEMENT );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_ELEMENTS.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_ELEMENTS );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_INDICES.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_INDICES );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_SIZE.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_SIZE );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MAX_INDEX.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_MAX_INDEX );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MIN_INDEX.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_MIN_INDEX );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MAX_ELEMENT.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_MAX_ELEMENT );
|
||||
HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MIN_ELEMENT.toLowerCase(Locale.ROOT), CollectionPropertyNames.COLLECTION_MIN_ELEMENT );
|
||||
HQL_COLLECTION_PROPERTIES.put( COLLECTION_INDEX_LOWER, CollectionPropertyNames.COLLECTION_INDEX );
|
||||
}
|
||||
|
||||
|
@ -55,7 +56,7 @@ public final class CollectionProperties {
|
|||
|
||||
@SuppressWarnings("SimplifiableIfStatement")
|
||||
public static boolean isCollectionProperty(String name) {
|
||||
final String key = name.toLowerCase();
|
||||
final String key = name.toLowerCase(Locale.ROOT);
|
||||
// CollectionPropertyMapping processes everything except 'index'.
|
||||
if ( COLLECTION_INDEX_LOWER.equals( key ) ) {
|
||||
return false;
|
||||
|
@ -70,7 +71,7 @@ public final class CollectionProperties {
|
|||
}
|
||||
|
||||
public static boolean isAnyCollectionProperty(String name) {
|
||||
final String key = name.toLowerCase();
|
||||
final String key = name.toLowerCase(Locale.ROOT);
|
||||
return HQL_COLLECTION_PROPERTIES.containsKey( key );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ package org.hibernate.hql.internal;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
|
@ -89,7 +90,7 @@ public final class QuerySplitter {
|
|||
int start = getStartingPositionFor( tokens, templateQuery );
|
||||
int count = 0;
|
||||
String next;
|
||||
String last = tokens[start - 1].toLowerCase();
|
||||
String last = tokens[start - 1].toLowerCase(Locale.ROOT);
|
||||
|
||||
for ( int i = start; i < tokens.length; i++ ) {
|
||||
|
||||
|
@ -100,12 +101,12 @@ public final class QuerySplitter {
|
|||
continue;
|
||||
}
|
||||
|
||||
next = nextNonWhite( tokens, i ).toLowerCase();
|
||||
next = nextNonWhite( tokens, i ).toLowerCase(Locale.ROOT);
|
||||
|
||||
boolean process = isJavaIdentifier( token ) &&
|
||||
isPossiblyClassName( last, next );
|
||||
|
||||
last = token.toLowerCase();
|
||||
last = token.toLowerCase(Locale.ROOT);
|
||||
|
||||
if ( process ) {
|
||||
String importedClassName = getImportedClass( token, factory );
|
||||
|
@ -144,13 +145,13 @@ public final class QuerySplitter {
|
|||
|
||||
private static int getStartingPositionFor(String[] tokens, StringBuilder templateQuery) {
|
||||
templateQuery.append( tokens[0] );
|
||||
if ( !"select".equals( tokens[0].toLowerCase() ) ) {
|
||||
if ( !"select".equals( tokens[0].toLowerCase(Locale.ROOT) ) ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// select-range is terminated by declaration of "from"
|
||||
for ( int i = 1; i < tokens.length; i++ ) {
|
||||
if ( "from".equals( tokens[i].toLowerCase() ) ) {
|
||||
if ( "from".equals( tokens[i].toLowerCase(Locale.ROOT) ) ) {
|
||||
return i;
|
||||
}
|
||||
templateQuery.append( tokens[i] );
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.hibernate.type.Type;
|
|||
|
||||
import antlr.SemanticException;
|
||||
import antlr.collections.AST;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Represents a constructor (new) in a SELECT.
|
||||
|
@ -146,11 +147,11 @@ public class ConstructorNode extends SelectExpressionList implements AggregatedS
|
|||
public void prepare() throws SemanticException {
|
||||
constructorArgumentTypes = resolveConstructorArgumentTypes();
|
||||
String path = ( (PathNode) getFirstChild() ).getPath();
|
||||
if ( "map".equals( path.toLowerCase() ) ) {
|
||||
if ( "map".equals( path.toLowerCase(Locale.ROOT) ) ) {
|
||||
isMap = true;
|
||||
resultType = Map.class;
|
||||
}
|
||||
else if ( "list".equals( path.toLowerCase() ) ) {
|
||||
else if ( "list".equals( path.toLowerCase(Locale.ROOT) ) ) {
|
||||
isList = true;
|
||||
resultType = List.class;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.jboss.logging.Logger;
|
|||
|
||||
import antlr.SemanticException;
|
||||
import antlr.collections.AST;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Represents a method call.
|
||||
|
@ -109,7 +110,7 @@ public class MethodNode extends AbstractSelectExpression implements FunctionNode
|
|||
name.setType( SqlTokenTypes.METHOD_NAME );
|
||||
String text = name.getText();
|
||||
// Use the lower case function name.
|
||||
methodName = text.toLowerCase();
|
||||
methodName = text.toLowerCase(Locale.ROOT);
|
||||
// Remember whether we're in a SELECT clause or not.
|
||||
this.inSelect = inSelect;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.jboss.logging.Logger;
|
|||
|
||||
import antlr.SemanticException;
|
||||
import antlr.collections.AST;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* A delegate that handles literals and constants for HqlSqlWalker, performing the token replacement functions and
|
||||
|
@ -207,7 +208,7 @@ public class LiteralProcessor implements HqlSqlTokenTypes {
|
|||
constant.setText( replacement );
|
||||
}
|
||||
else {
|
||||
boolean bool = "true".equals( constant.getText().toLowerCase() );
|
||||
boolean bool = "true".equals( constant.getText().toLowerCase(Locale.ROOT) );
|
||||
Dialect dialect = walker.getSessionFactoryHelper().getFactory().getDialect();
|
||||
constant.setText( dialect.toBooleanValueString( bool ) );
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.hql.internal.classic;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.QueryException;
|
||||
|
||||
|
@ -40,7 +41,7 @@ public class ClauseParser implements Parser {
|
|||
|
||||
@Override
|
||||
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
||||
String lcToken = token.toLowerCase();
|
||||
String lcToken = token.toLowerCase(Locale.ROOT);
|
||||
|
||||
if ( "(".equals( token ) ) {
|
||||
parenCount++;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
package org.hibernate.hql.internal.classic;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.QueryException;
|
||||
|
@ -70,7 +71,7 @@ public class FromParser implements Parser {
|
|||
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
||||
|
||||
// start by looking for HQL keywords...
|
||||
String lcToken = token.toLowerCase();
|
||||
String lcToken = token.toLowerCase(Locale.ROOT);
|
||||
if ( lcToken.equals( "," ) ) {
|
||||
if ( !( expectingJoin | expectingAs ) ) throw new QueryException( "unexpected token: ," );
|
||||
expectingJoin = false;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package org.hibernate.hql.internal.classic;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -107,7 +108,7 @@ public class PreprocessingParser implements Parser {
|
|||
}
|
||||
}
|
||||
else {
|
||||
String prop = CollectionProperties.getNormalizedPropertyName( token.toLowerCase() );
|
||||
String prop = CollectionProperties.getNormalizedPropertyName( token.toLowerCase(Locale.ROOT) );
|
||||
if ( prop != null ) {
|
||||
currentCollectionProp = prop;
|
||||
return;
|
||||
|
@ -123,7 +124,7 @@ public class PreprocessingParser implements Parser {
|
|||
String doubleToken = ( token.length() > 1 ) ?
|
||||
lastToken + ' ' + token :
|
||||
lastToken + token;
|
||||
if ( HQL_OPERATORS.contains( doubleToken.toLowerCase() ) ) {
|
||||
if ( HQL_OPERATORS.contains( doubleToken.toLowerCase(Locale.ROOT) ) ) {
|
||||
parser.token( doubleToken, q );
|
||||
lastToken = null;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -750,7 +751,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
parenCount--;
|
||||
}
|
||||
|
||||
String lc = token.toLowerCase();
|
||||
String lc = token.toLowerCase(Locale.ROOT);
|
||||
if ( lc.equals( ", " ) ) {
|
||||
if ( nolast ) {
|
||||
nolast = false;
|
||||
|
|
|
@ -26,6 +26,7 @@ package org.hibernate.hql.internal.classic;
|
|||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.QueryException;
|
||||
|
@ -75,7 +76,7 @@ public class SelectParser implements Parser {
|
|||
|
||||
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
||||
|
||||
String lctoken = token.toLowerCase();
|
||||
String lctoken = token.toLowerCase(Locale.ROOT);
|
||||
|
||||
if ( first ) {
|
||||
first = false;
|
||||
|
|
|
@ -27,6 +27,7 @@ package org.hibernate.hql.internal.classic;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
@ -210,7 +211,7 @@ public class WhereParser implements Parser {
|
|||
|
||||
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
||||
|
||||
String lcToken = token.toLowerCase();
|
||||
String lcToken = token.toLowerCase(Locale.ROOT);
|
||||
|
||||
//Cope with [,]
|
||||
if ( token.equals( "[" ) && !expectingPathContinuation ) {
|
||||
|
@ -441,7 +442,7 @@ public class WhereParser implements Parser {
|
|||
}
|
||||
else { //anything else
|
||||
|
||||
String negatedToken = negated ? ( String ) NEGATIONS.get( token.toLowerCase() ) : null;
|
||||
String negatedToken = negated ? ( String ) NEGATIONS.get( token.toLowerCase(Locale.ROOT) ) : null;
|
||||
if ( negatedToken != null && ( !betweenSpecialCase || !"or".equals( negatedToken ) ) ) {
|
||||
appendToken( q, negatedToken );
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ public final class StringHelper {
|
|||
}
|
||||
|
||||
public static boolean booleanValue(String tfString) {
|
||||
String trimmed = tfString.trim().toLowerCase();
|
||||
String trimmed = tfString.trim().toLowerCase(Locale.ROOT);
|
||||
return trimmed.equals( "true" ) || trimmed.equals( "t" );
|
||||
}
|
||||
|
||||
|
@ -558,7 +558,7 @@ public final class StringHelper {
|
|||
String result = truncate( unqualifyEntityName(description), ALIAS_TRUNCATE_LENGTH )
|
||||
// Important to use Locale.ENGLISH. See HHH-8579. #toLowerCase() uses the default Locale. Certain DBs
|
||||
// do not like non-ascii characters in aliases, etc., so ensure consistency/portability here.
|
||||
.toLowerCase(Locale.ENGLISH)
|
||||
.toLowerCase(Locale.ROOT)
|
||||
.replace( '/', '_' ) // entityNames may now include slashes for the representations
|
||||
.replace( '$', '_' ); //classname may be an inner class
|
||||
result = cleanAlias( result );
|
||||
|
@ -602,13 +602,13 @@ public final class StringHelper {
|
|||
}
|
||||
|
||||
public static String toUpperCase(String str) {
|
||||
return str==null ? null : str.toUpperCase();
|
||||
return str==null ? null : str.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public static String toLowerCase(String str) {
|
||||
// Important to use Locale.ENGLISH. See HHH-8579. #toLowerCase() uses the default Locale. Certain DBs do not
|
||||
// like non-ascii characters in aliases, etc., so ensure consistency/portability here.
|
||||
return str == null ? null : str.toLowerCase(Locale.ENGLISH);
|
||||
return str == null ? null : str.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public static String moveAndToBeginning(String filter) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.loader;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
|
@ -60,7 +61,7 @@ public enum BatchFetchStyle {
|
|||
private static final Logger log = Logger.getLogger( BatchFetchStyle.class );
|
||||
|
||||
public static BatchFetchStyle byName(String name) {
|
||||
return valueOf( name.toUpperCase() );
|
||||
return valueOf( name.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
|
||||
public static BatchFetchStyle interpret(Object setting) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.mapping;
|
||||
import java.io.Serializable;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
|
@ -122,7 +123,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
}
|
||||
|
||||
boolean useRawName = name.length() + suffix.length() <= dialect.getMaxAliasLength()
|
||||
&& !quoted && !name.toLowerCase().equals( "rowid" );
|
||||
&& !quoted && !name.toLowerCase(Locale.ROOT).equals( "rowid" );
|
||||
if ( !useRawName ) {
|
||||
if ( suffix.length() >= dialect.getMaxAliasLength() ) {
|
||||
throw new MappingException( String.format(
|
||||
|
@ -168,7 +169,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
//used also for generation of FK names!
|
||||
return isQuoted() ?
|
||||
name.hashCode() :
|
||||
name.toLowerCase().hashCode();
|
||||
name.toLowerCase(Locale.ROOT).hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -345,7 +346,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
}
|
||||
|
||||
public String getCanonicalName() {
|
||||
return quoted ? name : name.toLowerCase();
|
||||
return quoted ? name : name.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
|
@ -407,15 +408,15 @@ public class Table implements RelationalModel, Serializable, Exportable {
|
|||
throw new HibernateException( "Missing column: " + col.getName() + " in " + Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()));
|
||||
}
|
||||
else {
|
||||
final boolean typesMatch = col.getSqlType( dialect, mapping ).toLowerCase()
|
||||
.startsWith( columnInfo.getTypeName().toLowerCase() )
|
||||
final boolean typesMatch = col.getSqlType( dialect, mapping ).toLowerCase(Locale.ROOT)
|
||||
.startsWith( columnInfo.getTypeName().toLowerCase(Locale.ROOT) )
|
||||
|| columnInfo.getTypeCode() == col.getSqlTypeCode( mapping );
|
||||
if ( !typesMatch ) {
|
||||
throw new HibernateException(
|
||||
"Wrong column type in " +
|
||||
Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()) +
|
||||
" for column " + col.getName() +
|
||||
". Found: " + columnInfo.getTypeName().toLowerCase() +
|
||||
". Found: " + columnInfo.getTypeName().toLowerCase(Locale.ROOT) +
|
||||
", expected: " + col.getSqlType( dialect, mapping )
|
||||
);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ package org.hibernate.sql;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
|
@ -165,7 +166,7 @@ public final class Template {
|
|||
String nextToken = hasMore ? tokens.nextToken() : null;
|
||||
while ( hasMore ) {
|
||||
String token = nextToken;
|
||||
String lcToken = token.toLowerCase();
|
||||
String lcToken = token.toLowerCase(Locale.ROOT);
|
||||
hasMore = tokens.hasMoreTokens();
|
||||
nextToken = hasMore ? tokens.nextToken() : null;
|
||||
|
||||
|
@ -378,7 +379,7 @@ public final class Template {
|
|||
// String nextToken = hasMore ? tokens.nextToken() : null;
|
||||
// while ( hasMore ) {
|
||||
// String token = nextToken;
|
||||
// String lcToken = token.toLowerCase();
|
||||
// String lcToken = token.toLowerCase(Locale.ROOT);
|
||||
// hasMore = tokens.hasMoreTokens();
|
||||
// nextToken = hasMore ? tokens.nextToken() : null;
|
||||
//
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
package org.hibernate.tool.hbm2ddl;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
|
@ -56,7 +57,7 @@ public enum UniqueConstraintSchemaUpdateStrategy {
|
|||
private static final Logger log = Logger.getLogger( UniqueConstraintSchemaUpdateStrategy.class );
|
||||
|
||||
public static UniqueConstraintSchemaUpdateStrategy byName(String name) {
|
||||
return valueOf( name.toUpperCase() );
|
||||
return valueOf( name.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
|
||||
public static UniqueConstraintSchemaUpdateStrategy interpret(Object setting) {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.tool.schema.internal;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.model.naming.Identifier;
|
||||
|
@ -115,7 +116,7 @@ public class SchemaValidatorImpl implements SchemaValidator {
|
|||
ColumnInformation columnInformation,
|
||||
Metadata metadata) {
|
||||
boolean typesMatch = column.getSqlTypeCode( metadata ) == columnInformation.getTypeCode()
|
||||
|| column.getSqlType( dialect, metadata ).toLowerCase().startsWith( columnInformation.getTypeName().toLowerCase() );
|
||||
|| column.getSqlType( dialect, metadata ).toLowerCase(Locale.ROOT).startsWith( columnInformation.getTypeName().toLowerCase(Locale.ROOT) );
|
||||
if ( !typesMatch ) {
|
||||
throw new SchemaManagementException(
|
||||
String.format(
|
||||
|
@ -123,9 +124,9 @@ public class SchemaValidatorImpl implements SchemaValidator {
|
|||
"table [%s]; found [%s (Types#%s)], but expecting [%s (Types#%s)]",
|
||||
column.getName(),
|
||||
table.getName(),
|
||||
columnInformation.getTypeName().toLowerCase(),
|
||||
columnInformation.getTypeName().toLowerCase(Locale.ROOT),
|
||||
JdbcTypeNameMapper.getTypeName( columnInformation.getTypeCode() ),
|
||||
column.getSqlType().toLowerCase(),
|
||||
column.getSqlType().toLowerCase(Locale.ROOT),
|
||||
JdbcTypeNameMapper.getTypeName( column.getSqlTypeCode( metadata ) )
|
||||
)
|
||||
);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -60,7 +61,7 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase {
|
|||
"with query as (select inner_query.*, row_number() over (order by current_timestamp) as __hibernate_row_nr__ from ( " +
|
||||
"select distinct top(?) f1 as f53245 from table849752 order by f234, f67 desc ) inner_query )" +
|
||||
" select f53245 from query where __hibernate_row_nr__ >= ? and __hibernate_row_nr__ < ?",
|
||||
dialect.getLimitHandler().processSql( input, toRowSelection( 10, 15 ) ).toLowerCase() );
|
||||
dialect.getLimitHandler().processSql( input, toRowSelection( 10, 15 ) ).toLowerCase(Locale.ROOT) );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -142,7 +143,7 @@ public class BasicOperationsTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
private String generateFinalNamePattern(DatabaseMetaData meta, String name) throws SQLException {
|
||||
if ( meta.storesLowerCaseIdentifiers() ) {
|
||||
return name.toLowerCase();
|
||||
return name.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
else {
|
||||
return name;
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.Currency;
|
|||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import org.hibernate.dialect.TeradataDialect;
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
|
@ -528,8 +529,8 @@ public class BasicHibernateAnnotationsTest extends BaseCoreFunctionalTestCase {
|
|||
s = openSession();
|
||||
tx = s.beginTransaction();
|
||||
Forest f2 = (Forest) s.get( Forest.class, f.getId() );
|
||||
assertEquals( f.getSmallText().toLowerCase(), f2.getSmallText() );
|
||||
assertEquals( f.getBigText().toUpperCase(), f2.getBigText() );
|
||||
assertEquals( f.getSmallText().toLowerCase(Locale.ROOT), f2.getSmallText() );
|
||||
assertEquals( f.getBigText().toUpperCase(Locale.ROOT), f2.getBigText() );
|
||||
tx.commit();
|
||||
s.close();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
|
@ -41,10 +42,10 @@ public class CasterStringType implements UserType, ParameterizedType {
|
|||
String result = rs.getString( names[0] );
|
||||
if ( rs.wasNull() ) return null;
|
||||
if ( parameters.getProperty( CAST ).equals( "lower" ) ) {
|
||||
return result.toLowerCase();
|
||||
return result.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
else {
|
||||
return result.toUpperCase();
|
||||
return result.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,10 +56,10 @@ public class CasterStringType implements UserType, ParameterizedType {
|
|||
else {
|
||||
String string = (String) value;
|
||||
if ( parameters.getProperty( CAST ).equals( "lower" ) ) {
|
||||
string = string.toLowerCase();
|
||||
string = string.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
else {
|
||||
string = string.toUpperCase();
|
||||
string = string.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
st.setString( index, string );
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.test.annotations.join;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.HibernateException;
|
||||
|
@ -218,7 +219,7 @@ public class JoinTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
s.clear();
|
||||
|
||||
Cat c = (Cat) s.get( Cat.class, cat.getId() );
|
||||
assertEquals( storyPart2.toUpperCase(), c.getStoryPart2() );
|
||||
assertEquals( storyPart2.toUpperCase(Locale.ROOT), c.getStoryPart2() );
|
||||
|
||||
tx.rollback();
|
||||
s.close();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// $Id$
|
||||
package org.hibernate.test.annotations.namingstrategy;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.MetadataSources;
|
||||
import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl;
|
||||
|
@ -62,7 +63,7 @@ public class NamingStrategyTest extends BaseUnitTestCase {
|
|||
assertEquals(
|
||||
"Expecting A#address collection table name (implicit) to be [A_address] per JPA spec (section 11.1.8)",
|
||||
"A_ADDRESS",
|
||||
collectionBinding.getCollectionTable().getQuotedName().toUpperCase()
|
||||
collectionBinding.getCollectionTable().getQuotedName().toUpperCase(Locale.ROOT)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.Query;
|
||||
|
@ -398,7 +399,7 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
|
|||
chaos.setId( 1l );
|
||||
|
||||
String lowerName = "hello";
|
||||
String upperName = lowerName.toUpperCase();
|
||||
String upperName = lowerName.toUpperCase(Locale.ROOT);
|
||||
assertFalse( lowerName.equals( upperName ) );
|
||||
|
||||
chaos.setName( "hello" );
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.test.interceptor;
|
|||
import java.io.Serializable;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -296,8 +297,8 @@ public class InterceptorTest extends BaseCoreFunctionalTestCase {
|
|||
@Override
|
||||
public String onPrepareStatement(String sql) {
|
||||
assertNotNull( sql );
|
||||
String expectedSql = expectedSQLs.poll().toLowerCase();
|
||||
assertTrue("sql:\n " + sql.toLowerCase() +"\n doesn't start with \n"+expectedSql+"\n", sql.toLowerCase().startsWith( expectedSql ) );
|
||||
String expectedSql = expectedSQLs.poll().toLowerCase(Locale.ROOT);
|
||||
assertTrue("sql:\n " + sql.toLowerCase(Locale.ROOT) +"\n doesn't start with \n"+expectedSql+"\n", sql.toLowerCase(Locale.ROOT).startsWith( expectedSql ) );
|
||||
return sql;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//$Id: Document.java 7772 2005-08-05 23:03:46Z oneovthafew $
|
||||
package org.hibernate.test.lazycache;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author Gavin King
|
||||
|
@ -17,7 +18,7 @@ public class Document {
|
|||
public Document(String name, String summary, String text) {
|
||||
lastTextModification = new Date();
|
||||
this.name = name;
|
||||
upperCaseName = name.toUpperCase();
|
||||
upperCaseName = name.toUpperCase(Locale.ROOT);
|
||||
this.summary = summary;
|
||||
this.text = text;
|
||||
}
|
||||
|
|
|
@ -1951,7 +1951,7 @@ public class FooBarTest extends LegacyTestCase {
|
|||
List list = s.createCriteria(Foo.class)
|
||||
.add( Restrictions.eq( "integer", f.getInteger() ) )
|
||||
.add( Restrictions.eqProperty("integer", "integer") )
|
||||
.add( Restrictions.like( "string", f.getString().toUpperCase() ).ignoreCase() )
|
||||
.add( Restrictions.like( "string", f.getString().toUpperCase(Locale.ROOT) ).ignoreCase() )
|
||||
.add( Restrictions.in( "boolean", new Boolean[] { f.getBoolean(), f.getBoolean() } ) )
|
||||
.setFetchMode("foo", FetchMode.JOIN)
|
||||
.setFetchMode("baz", FetchMode.SELECT)
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package org.hibernate.test.legacy;
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
|
||||
public class StringComparator implements Comparator, Serializable {
|
||||
|
||||
public int compare(Object o1, Object o2) {
|
||||
return ( (String) o1 ).toLowerCase().compareTo( ( (String) o2 ).toLowerCase() );
|
||||
return ( (String) o1 ).toLowerCase(Locale.ROOT).compareTo( ( (String) o2 ).toLowerCase(Locale.ROOT) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.test.manytomany.batchload;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
import org.hibernate.Hibernate;
|
||||
|
@ -97,7 +98,7 @@ public class BatchedManyToManyTest extends BaseCoreFunctionalTestCase {
|
|||
// of dialects...
|
||||
Assert.assertFalse(
|
||||
"batch load of many-to-many should use inner join",
|
||||
sql.toLowerCase().contains( "left outer join" )
|
||||
sql.toLowerCase(Locale.ROOT).contains( "left outer join" )
|
||||
);
|
||||
return super.onPrepareStatement( sql );
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.math.BigInteger;
|
|||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
|
@ -906,7 +907,7 @@ public class NativeSQLQueriesTest extends BaseCoreFunctionalTestCase {
|
|||
for ( int i = 0; i < tuple.length; i++ ) {
|
||||
String alias = aliases[i];
|
||||
if ( alias != null ) {
|
||||
result.put( alias.toUpperCase(), tuple[i] );
|
||||
result.put( alias.toUpperCase(Locale.ROOT), tuple[i] );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.test.stateless.fetching;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Session;
|
||||
|
@ -74,7 +75,7 @@ public class StatelessSessionFetchingTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
private String determineUniquePrefix() {
|
||||
return StringHelper.collapseQualifier( getClass().getName(), false ).toUpperCase();
|
||||
return StringHelper.collapseQualifier( getClass().getName(), false ).toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.jpa.criteria.expression.function;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import javax.persistence.criteria.Expression;
|
||||
|
||||
import org.hibernate.jpa.criteria.CriteriaBuilderImpl;
|
||||
|
@ -73,7 +74,7 @@ public class ParameterizedFunctionExpression<X>
|
|||
List<Expression<?>> argumentExpressions) {
|
||||
super( criteriaBuilder, javaType, functionName );
|
||||
this.argumentExpressions = argumentExpressions;
|
||||
this.isStandardJpaFunction = STANDARD_JPA_FUNCTION_NAMES.contains( functionName.toUpperCase() );
|
||||
this.isStandardJpaFunction = STANDARD_JPA_FUNCTION_NAMES.contains( functionName.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
|
||||
public ParameterizedFunctionExpression(
|
||||
|
@ -83,7 +84,7 @@ public class ParameterizedFunctionExpression<X>
|
|||
Expression<?>... argumentExpressions) {
|
||||
super( criteriaBuilder, javaType, functionName );
|
||||
this.argumentExpressions = Arrays.asList( argumentExpressions );
|
||||
this.isStandardJpaFunction = STANDARD_JPA_FUNCTION_NAMES.contains( functionName.toUpperCase() );
|
||||
this.isStandardJpaFunction = STANDARD_JPA_FUNCTION_NAMES.contains( functionName.toUpperCase(Locale.ROOT) );
|
||||
}
|
||||
|
||||
protected boolean isStandardJpaFunction() {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.jpa.internal.util;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import javax.persistence.FlushModeType;
|
||||
|
@ -65,7 +66,7 @@ public abstract class ConfigurationHelper {
|
|||
if (flushMode == null) {
|
||||
return null;
|
||||
}
|
||||
flushMode = flushMode.toUpperCase();
|
||||
flushMode = flushMode.toUpperCase(Locale.ROOT);
|
||||
return FlushMode.valueOf( flushMode );
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ package org.hibernate.jpa.internal.util;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -192,7 +193,7 @@ public final class XmlHelper {
|
|||
public static boolean getOptionalChildBooleanContent(Element element, String name) throws Exception {
|
||||
Element child = getOptionalChild( element, name );
|
||||
if ( child != null ) {
|
||||
String value = getElementContent( child ).toLowerCase();
|
||||
String value = getElementContent( child ).toLowerCase(Locale.ROOT);
|
||||
return value.equals( "true" ) || value.equals( "yes" );
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.jpa.test.metadata;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.metamodel.Attribute;
|
||||
|
@ -413,7 +414,7 @@ public class MetadataTest extends BaseEntityManagerFunctionalTestCase {
|
|||
for (Attribute<?,?> attribute : safeAttributes ) {
|
||||
final String name = attribute.getJavaMember().getName();
|
||||
assertNotNull( attribute.getJavaMember() );
|
||||
assertTrue( name.toLowerCase().endsWith( attribute.getName().toLowerCase() ) );
|
||||
assertTrue( name.toLowerCase(Locale.ROOT).endsWith( attribute.getName().toLowerCase(Locale.ROOT) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.hibernate.envers.query.criteria.internal;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.hibernate.envers.boot.internal.EnversService;
|
||||
import org.hibernate.envers.internal.reader.AuditReaderImplementor;
|
||||
import org.hibernate.envers.internal.tools.query.Parameters;
|
||||
|
@ -30,7 +31,7 @@ public class IlikeAuditExpression implements AuditCriterion {
|
|||
);
|
||||
CriteriaTools.checkPropertyNotARelation( enversService, entityName, propertyName );
|
||||
|
||||
parameters.addWhereWithFunction( propertyName, " lower ", " like ", value.toLowerCase() );
|
||||
parameters.addWhereWithFunction( propertyName, " lower ", " like ", value.toLowerCase(Locale.ROOT) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
package org.hibernate.jpamodelgen.util;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author Hardy Ferentschik
|
||||
*/
|
||||
|
@ -104,7 +106,7 @@ public final class StringUtil {
|
|||
return string;
|
||||
}
|
||||
else {
|
||||
return string.substring( 0, 1 ).toLowerCase() + string.substring( 1 );
|
||||
return string.substring( 0, 1 ).toLowerCase(Locale.ROOT) + string.substring( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue