Skip to content

Commit

Permalink
HSEARCH-1938 Enum name uppercasing needs to use a locale neutral stra…
Browse files Browse the repository at this point in the history
…tegy
  • Loading branch information
Sanne committed Jul 29, 2015
1 parent 6586979 commit da97f12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -6,6 +6,7 @@
*/
package org.hibernate.search.engine.impl;

import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
Expand Down Expand Up @@ -167,7 +168,7 @@ private ObjectLookupMethod determineDefaultObjectLookupMethod() {
}
else {
try {
return Enum.valueOf( ObjectLookupMethod.class, objectLookupMethod.toUpperCase() );
return Enum.valueOf( ObjectLookupMethod.class, objectLookupMethod.toUpperCase( Locale.ROOT ) );
}
catch (IllegalArgumentException e) {
throw log.invalidPropertyValue( objectLookupMethod, Environment.OBJECT_LOOKUP_METHOD );
Expand All @@ -182,7 +183,7 @@ private DatabaseRetrievalMethod determineDefaultDatabaseRetrievalMethod() {
}
else {
try {
return Enum.valueOf( DatabaseRetrievalMethod.class, databaseRetrievalMethod.toUpperCase() );
return Enum.valueOf( DatabaseRetrievalMethod.class, databaseRetrievalMethod.toUpperCase( Locale.ROOT ) );
}
catch (IllegalArgumentException e) {
throw log.invalidPropertyValue( databaseRetrievalMethod, Environment.OBJECT_LOOKUP_METHOD );
Expand Down
Expand Up @@ -10,6 +10,7 @@
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Locale;
import java.util.Properties;

import org.apache.lucene.store.FSDirectory;
Expand Down Expand Up @@ -268,7 +269,7 @@ public static FSDirectoryType getType(Properties properties) {
String fsDirectoryTypeValue = properties.getProperty( FS_DIRECTORY_TYPE_PROP_NAME );
if ( StringHelper.isNotEmpty( fsDirectoryTypeValue ) ) {
try {
fsDirectoryType = Enum.valueOf( FSDirectoryType.class, fsDirectoryTypeValue.toUpperCase() );
fsDirectoryType = Enum.valueOf( FSDirectoryType.class, fsDirectoryTypeValue.toUpperCase( Locale.ROOT ) );
}
catch (IllegalArgumentException e) {
throw new SearchException( "Invalid option value for " + FS_DIRECTORY_TYPE_PROP_NAME + ": " + fsDirectoryTypeValue );
Expand Down

0 comments on commit da97f12

Please sign in to comment.