mirror of https://github.com/apache/lucene.git
LUCENE-2466: fix locale bugs for tr_TR locale: casing problems in lucene/solr code
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@945245 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cd45643b96
commit
824939d7e5
|
@ -36,7 +36,7 @@ public class TestCharArrayMap extends LuceneTestCase {
|
|||
key[j] = (char)r.nextInt(127);
|
||||
}
|
||||
String keyStr = new String(key);
|
||||
String hmapKey = ignoreCase ? keyStr.toLowerCase() : keyStr;
|
||||
String hmapKey = ignoreCase ? keyStr.toLowerCase(Locale.ENGLISH) : keyStr;
|
||||
|
||||
int val = r.nextInt();
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.apache.lucene.analysis;
|
|||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.lucene.analysis.tokenattributes.KeywordAttribute;
|
||||
|
@ -64,7 +65,7 @@ public class TestKeywordMarkerFilter extends BaseTokenStreamTestCase {
|
|||
public boolean incrementToken() throws IOException {
|
||||
if (input.incrementToken()) {
|
||||
if (!keywordAttr.isKeyword()) {
|
||||
final String term = termAtt.toString().toLowerCase();
|
||||
final String term = termAtt.toString().toLowerCase(Locale.ENGLISH);
|
||||
termAtt.setEmpty().append(term);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -378,6 +378,8 @@ Build
|
|||
* SOLR-1891: Make lucene-jars-to-solr fail if copying any of the jars fails, and
|
||||
update clean to remove the jars in that directory (Mark Miller)
|
||||
|
||||
* LUCENE-2466: Commons-Codec was upgraded from 1.3 to 1.4. (rmuir)
|
||||
|
||||
Documentation
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.solr.handler.dataimport;
|
||||
|
||||
import com.sun.mail.imap.IMAPMessage;
|
||||
|
||||
import org.apache.tika.config.TikaConfig;
|
||||
import org.apache.tika.utils.ParseUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -161,7 +162,7 @@ public class MailEntityProcessor extends EntityProcessorBase {
|
|||
if (!processAttachment || (disp != null && disp.equalsIgnoreCase(Part.ATTACHMENT))) return;
|
||||
InputStream is = part.getInputStream();
|
||||
String fileName = part.getFileName();
|
||||
String content = ParseUtils.getStringContent(is, TikaConfig.getDefaultConfig(), ctype.getBaseType().toLowerCase());
|
||||
String content = ParseUtils.getStringContent(is, TikaConfig.getDefaultConfig(), ctype.getBaseType().toLowerCase(Locale.ENGLISH));
|
||||
if (disp != null && disp.equalsIgnoreCase(Part.ATTACHMENT)) {
|
||||
if (row.get(ATTACHMENT) == null)
|
||||
row.put(ATTACHMENT, new ArrayList<String>());
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.solr.core.SolrCore;
|
|||
import org.apache.solr.schema.IndexSchema;
|
||||
import org.apache.solr.schema.SchemaField;
|
||||
import org.apache.solr.common.util.ContentStream;
|
||||
|
||||
import static org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow;
|
||||
import static org.apache.solr.handler.dataimport.DataImportHandlerException.SEVERE;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -98,7 +99,7 @@ public class DataImporter {
|
|||
loadDataConfig(dataConfig);
|
||||
|
||||
for (Map.Entry<String, SchemaField> entry : schema.getFields().entrySet()) {
|
||||
config.lowerNameVsSchemaField.put(entry.getKey().toLowerCase(), entry.getValue());
|
||||
config.lowerNameVsSchemaField.put(entry.getKey().toLowerCase(Locale.ENGLISH), entry.getValue());
|
||||
}
|
||||
|
||||
for (DataConfig.Entity e : config.document.entities) {
|
||||
|
@ -125,7 +126,7 @@ public class DataImporter {
|
|||
DataConfig.Field fld = entry.getValue();
|
||||
SchemaField field = schema.getFieldOrNull(fld.getName());
|
||||
if (field == null) {
|
||||
field = config.lowerNameVsSchemaField.get(fld.getName().toLowerCase());
|
||||
field = config.lowerNameVsSchemaField.get(fld.getName().toLowerCase(Locale.ENGLISH));
|
||||
if (field == null) {
|
||||
LOG.info("The field :" + fld.getName() + " present in DataConfig does not have a counterpart in Solr Schema");
|
||||
}
|
||||
|
@ -215,7 +216,7 @@ public class DataImporter {
|
|||
}
|
||||
SchemaField schemaField = schema.getFieldOrNull(f.getName());
|
||||
if (schemaField == null) {
|
||||
schemaField = config.lowerNameVsSchemaField.get(f.getName().toLowerCase());
|
||||
schemaField = config.lowerNameVsSchemaField.get(f.getName().toLowerCase(Locale.ENGLISH));
|
||||
if (schemaField != null) f.name = schemaField.getName();
|
||||
}
|
||||
if (schemaField != null) {
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.apache.solr.common.SolrInputDocument;
|
|||
import org.apache.solr.core.SolrCore;
|
||||
import static org.apache.solr.handler.dataimport.SolrWriter.LAST_INDEX_KEY;
|
||||
import static org.apache.solr.handler.dataimport.DataImportHandlerException.*;
|
||||
import static org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow;
|
||||
import org.apache.solr.schema.SchemaField;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -744,7 +743,7 @@ public class DocBuilder {
|
|||
// This can be a dynamic field or a field which does not have an entry in data-config ( an implicit field)
|
||||
SchemaField sf = dataImporter.getSchema().getFieldOrNull(key);
|
||||
if (sf == null) {
|
||||
sf = dataImporter.getConfig().lowerNameVsSchemaField.get(key.toLowerCase());
|
||||
sf = dataImporter.getConfig().lowerNameVsSchemaField.get(key.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
if (sf != null) {
|
||||
addFieldToDoc(entry.getValue(), sf.getName(), 1.0f, sf.multiValued(), doc);
|
||||
|
|
|
@ -72,7 +72,7 @@ public class NumberFormatTransformer extends Transformer {
|
|||
}
|
||||
|
||||
Object val = row.get(srcCol);
|
||||
String styleSmall = style.toLowerCase();
|
||||
String styleSmall = style.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (val instanceof List) {
|
||||
List<String> inputs = (List) val;
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.junit.Test;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -111,7 +112,7 @@ public class TestCachedSqlEntityProcessor {
|
|||
if (r == null)
|
||||
break;
|
||||
rows.add(r);
|
||||
Assert.assertEquals(r.get("desc").toString().toUpperCase(), r.get("desc"));
|
||||
Assert.assertEquals(r.get("desc").toString().toUpperCase(Locale.ENGLISH), r.get("desc"));
|
||||
}
|
||||
Assert.assertEquals(2, rows.size());
|
||||
Assert.assertEquals(2, rows.get(0).size());
|
||||
|
@ -178,7 +179,7 @@ public class TestCachedSqlEntityProcessor {
|
|||
Object val = entry.getValue();
|
||||
if (val instanceof String) {
|
||||
String s = (String) val;
|
||||
entry.setValue(s.toUpperCase());
|
||||
entry.setValue(s.toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
}
|
||||
return row;
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.xml.sax.SAXException;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -135,7 +136,7 @@ public class ExtractingDocumentLoader extends ContentStreamLoader {
|
|||
String streamType = req.getParams().get(ExtractingParams.STREAM_TYPE, null);
|
||||
if (streamType != null) {
|
||||
//Cache? Parsers are lightweight to construct and thread-safe, so I'm told
|
||||
MediaType mt = MediaType.parse(streamType.trim().toLowerCase());
|
||||
MediaType mt = MediaType.parse(streamType.trim().toLowerCase(Locale.ENGLISH));
|
||||
parser = config.getParser(mt);
|
||||
} else {
|
||||
parser = autoDetectParser;
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
AnyObjectId[957b6752af9a60c1bb2a4f65db0e90e5ce00f521] was removed in git history.
|
||||
Apache SVN contains full history.
|
|
@ -0,0 +1,2 @@
|
|||
AnyObjectId[458d432da88b0efeab640c229903fb5aad274044] was removed in git history.
|
||||
Apache SVN contains full history.
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.solr.common.params;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
* Parameters used across many handlers
|
||||
|
@ -101,7 +103,7 @@ public interface CommonParams {
|
|||
|
||||
public static EchoParamStyle get( String v ) {
|
||||
if( v != null ) {
|
||||
v = v.toUpperCase();
|
||||
v = v.toUpperCase(Locale.ENGLISH);
|
||||
if( v.equals( "EXPLICIT" ) ) {
|
||||
return EXPLICIT;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.apache.solr.common.params;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @since solr 1.3
|
||||
*/
|
||||
|
@ -74,7 +76,7 @@ public interface CoreAdminParams
|
|||
{
|
||||
if( p != null ) {
|
||||
try {
|
||||
return CoreAdminAction.valueOf( p.toUpperCase() );
|
||||
return CoreAdminAction.valueOf( p.toUpperCase(Locale.ENGLISH) );
|
||||
}
|
||||
catch( Exception ex ) {}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.solr.common.params;
|
|||
import org.apache.solr.common.SolrException;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Facet parameters
|
||||
|
@ -170,10 +171,10 @@ public interface FacetParams {
|
|||
*/
|
||||
public enum FacetDateOther {
|
||||
BEFORE, AFTER, BETWEEN, ALL, NONE;
|
||||
public String toString() { return super.toString().toLowerCase(); }
|
||||
public String toString() { return super.toString().toLowerCase(Locale.ENGLISH); }
|
||||
public static FacetDateOther get(String label) {
|
||||
try {
|
||||
return valueOf(label.toUpperCase());
|
||||
return valueOf(label.toUpperCase(Locale.ENGLISH));
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new SolrException
|
||||
(SolrException.ErrorCode.BAD_REQUEST,
|
||||
|
@ -217,10 +218,10 @@ public interface FacetParams {
|
|||
*/
|
||||
public enum FacetDateInclude {
|
||||
ALL, LOWER, UPPER, EDGE, OUTER;
|
||||
public String toString() { return super.toString().toLowerCase(); }
|
||||
public String toString() { return super.toString().toLowerCase(Locale.ENGLISH); }
|
||||
public static FacetDateInclude get(String label) {
|
||||
try {
|
||||
return valueOf(label.toUpperCase());
|
||||
return valueOf(label.toUpperCase(Locale.ENGLISH));
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new SolrException
|
||||
(SolrException.ErrorCode.BAD_REQUEST,
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.solr.common.params;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @since solr 1.3
|
||||
*/
|
||||
|
@ -57,7 +59,7 @@ public interface MoreLikeThisParams
|
|||
public static TermStyle get( String p )
|
||||
{
|
||||
if( p != null ) {
|
||||
p = p.toUpperCase();
|
||||
p = p.toUpperCase(Locale.ENGLISH);
|
||||
if( p.equals( "DETAILS" ) ) {
|
||||
return DETAILS;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.io.Reader;
|
|||
import java.io.StringReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -51,7 +52,7 @@ public abstract class ContentStreamBase implements ContentStream
|
|||
public static String getCharsetFromContentType( String contentType )
|
||||
{
|
||||
if( contentType != null ) {
|
||||
int idx = contentType.toLowerCase().indexOf( "charset=" );
|
||||
int idx = contentType.toLowerCase(Locale.ENGLISH).indexOf( "charset=" );
|
||||
if( idx > 0 ) {
|
||||
return contentType.substring( idx + "charset=".length() ).trim();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.solr.common.util;
|
|||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.solr.common.SolrException;
|
||||
|
@ -207,7 +208,7 @@ public class StrUtils {
|
|||
public static List<String> toLower(List<String> strings) {
|
||||
ArrayList<String> ret = new ArrayList<String>(strings.size());
|
||||
for (String str : strings) {
|
||||
ret.add(str.toLowerCase());
|
||||
ret.add(str.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.solr.analysis;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.codec.Encoder;
|
||||
|
@ -28,6 +29,7 @@ import org.apache.commons.codec.language.RefinedSoundex;
|
|||
import org.apache.commons.codec.language.Soundex;
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.util.StrUtils;
|
||||
|
||||
/**
|
||||
* Create tokens based on phonetic encoders
|
||||
|
@ -50,10 +52,10 @@ public class PhoneticFilterFactory extends BaseTokenFilterFactory
|
|||
private static final Map<String, Class<? extends Encoder>> registry;
|
||||
static {
|
||||
registry = new HashMap<String, Class<? extends Encoder>>();
|
||||
registry.put( "DoubleMetaphone".toUpperCase(), DoubleMetaphone.class );
|
||||
registry.put( "Metaphone".toUpperCase(), Metaphone.class );
|
||||
registry.put( "Soundex".toUpperCase(), Soundex.class );
|
||||
registry.put( "RefinedSoundex".toUpperCase(), RefinedSoundex.class );
|
||||
registry.put( "DoubleMetaphone".toUpperCase(Locale.ENGLISH), DoubleMetaphone.class );
|
||||
registry.put( "Metaphone".toUpperCase(Locale.ENGLISH), Metaphone.class );
|
||||
registry.put( "Soundex".toUpperCase(Locale.ENGLISH), Soundex.class );
|
||||
registry.put( "RefinedSoundex".toUpperCase(Locale.ENGLISH), RefinedSoundex.class );
|
||||
}
|
||||
|
||||
protected boolean inject = true;
|
||||
|
@ -71,7 +73,7 @@ public class PhoneticFilterFactory extends BaseTokenFilterFactory
|
|||
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Missing required parameter: "+ENCODER
|
||||
+" ["+registry.keySet()+"]" );
|
||||
}
|
||||
Class<? extends Encoder> clazz = registry.get(name.toUpperCase());
|
||||
Class<? extends Encoder> clazz = registry.get(name.toUpperCase(Locale.ENGLISH));
|
||||
if( clazz == null ) {
|
||||
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Unknown encoder: "+name +" ["+registry.keySet()+"]" );
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.w3c.dom.Node;
|
|||
import org.xml.sax.SAXException;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.util.DOMUtil;
|
||||
|
||||
import javax.xml.parsers.*;
|
||||
import javax.xml.xpath.XPath;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
|
@ -31,6 +32,7 @@ import javax.xml.namespace.QName;
|
|||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Collections;
|
||||
|
@ -285,7 +287,7 @@ public class Config {
|
|||
private static final AtomicBoolean versionWarningAlreadyLogged = new AtomicBoolean(false);
|
||||
|
||||
public static final Version parseLuceneVersionString(final String matchVersion) {
|
||||
String parsedMatchVersion = matchVersion.toUpperCase();
|
||||
String parsedMatchVersion = matchVersion.toUpperCase(Locale.ENGLISH);
|
||||
|
||||
// be lenient with the supplied version parameter
|
||||
parsedMatchVersion = parsedMatchVersion.replaceFirst("^(\\d)\\.(\\d)$", "LUCENE_$1$2");
|
||||
|
|
|
@ -243,7 +243,7 @@ public class JmxMonitoredMap<K, V> extends
|
|||
if (staticStats.contains(attribute) && attribute != null
|
||||
&& attribute.length() > 0) {
|
||||
try {
|
||||
String getter = "get" + attribute.substring(0, 1).toUpperCase()
|
||||
String getter = "get" + attribute.substring(0, 1).toUpperCase(Locale.ENGLISH)
|
||||
+ attribute.substring(1);
|
||||
Method meth = infoBean.getClass().getMethod(getter);
|
||||
val = meth.invoke(infoBean);
|
||||
|
|
|
@ -367,7 +367,7 @@ public class SolrConfig extends Config {
|
|||
/** Input must not be null */
|
||||
public static LastModFrom parse(final String s) {
|
||||
try {
|
||||
return valueOf(s.toUpperCase());
|
||||
return valueOf(s.toUpperCase(Locale.ENGLISH));
|
||||
} catch (Exception e) {
|
||||
log.warn( "Unrecognized value for lastModFrom: " + s, e);
|
||||
return BOGUS;
|
||||
|
|
|
@ -1554,14 +1554,14 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
File configdir = new File( solrConfig.getResourceLoader().getConfigDir() );
|
||||
if( configdir.exists() && configdir.isDirectory() ) {
|
||||
for( String file : configdir.list() ) {
|
||||
hide.add( file.toUpperCase() );
|
||||
hide.add( file.toUpperCase(Locale.ENGLISH) );
|
||||
}
|
||||
}
|
||||
|
||||
// except the "gettable" list
|
||||
StringTokenizer st = new StringTokenizer( gettable );
|
||||
while( st.hasMoreTokens() ) {
|
||||
hide.remove( st.nextToken().toUpperCase() );
|
||||
hide.remove( st.nextToken().toUpperCase(Locale.ENGLISH) );
|
||||
}
|
||||
for( String s : hide ) {
|
||||
invariants.add( ShowFileRequestHandler.HIDDEN, s );
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
@ -105,7 +106,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase
|
|||
String[] hidden = invariants.getParams( HIDDEN );
|
||||
if( hidden != null ) {
|
||||
for( String s : hidden ) {
|
||||
hiddenFiles.add( s.toUpperCase() );
|
||||
hiddenFiles.add( s.toUpperCase(Locale.ENGLISH) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +130,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase
|
|||
}
|
||||
else {
|
||||
fname = fname.replace( '\\', '/' ); // normalize slashes
|
||||
if( hiddenFiles.contains( fname.toUpperCase() ) ) {
|
||||
if( hiddenFiles.contains( fname.toUpperCase(Locale.ENGLISH) ) ) {
|
||||
throw new SolrException( ErrorCode.FORBIDDEN, "Can not access: "+fname );
|
||||
}
|
||||
if( fname.indexOf( ".." ) >= 0 ) {
|
||||
|
@ -156,7 +157,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase
|
|||
for( File f : adminFile.listFiles() ) {
|
||||
String path = f.getAbsolutePath().substring( basePath );
|
||||
path = path.replace( '\\', '/' ); // normalize slashes
|
||||
if( hiddenFiles.contains( path.toUpperCase() ) ) {
|
||||
if( hiddenFiles.contains( path.toUpperCase(Locale.ENGLISH) ) ) {
|
||||
continue; // don't show 'hidden' files
|
||||
}
|
||||
if( f.isHidden() || f.getName().startsWith( "." ) ) {
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.lang.reflect.Method;
|
|||
import java.net.InetAddress;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.lucene.LucenePackage;
|
||||
|
@ -122,7 +123,7 @@ public class SystemInfoHandler extends RequestHandlerBase
|
|||
addGetterIfAvaliable( os, "processCpuTime", info );
|
||||
|
||||
try {
|
||||
if( !os.getName().toLowerCase().startsWith( "windows" ) ) {
|
||||
if( !os.getName().toLowerCase(Locale.ENGLISH).startsWith( "windows" ) ) {
|
||||
// Try some command line things
|
||||
info.add( "uname", execute( "uname -a" ) );
|
||||
info.add( "ulimit", execute( "ulimit -n" ) );
|
||||
|
|
|
@ -36,6 +36,7 @@ import java.util.Arrays;
|
|||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
|
@ -186,7 +187,7 @@ public class TermsComponent extends SearchComponent {
|
|||
int flags = 0;
|
||||
for (String flagParam : flagParams) {
|
||||
try {
|
||||
flags |= TermsParams.TermsRegexpFlag.valueOf(flagParam.toUpperCase()).getValue();
|
||||
flags |= TermsParams.TermsRegexpFlag.valueOf(flagParam.toUpperCase(Locale.ENGLISH)).getValue();
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown terms regex flag '" + flagParam + "'");
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.solr.search.QParser;
|
|||
import org.apache.solr.search.function.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -77,7 +78,7 @@ public class TrieField extends FieldType {
|
|||
|
||||
if (t != null) {
|
||||
try {
|
||||
type = TrieTypes.valueOf(t.toUpperCase());
|
||||
type = TrieTypes.valueOf(t.toUpperCase(Locale.ENGLISH));
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
|
||||
"Invalid type specified in schema.xml for field: " + args.get("name"), e);
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.solr.schema;
|
|||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -76,7 +77,7 @@ public class UUIDField extends FieldType {
|
|||
@Override
|
||||
public String toInternal(String val) {
|
||||
if (val == null || 0==val.length() || NEW.equals(val)) {
|
||||
return UUID.randomUUID().toString().toLowerCase();
|
||||
return UUID.randomUUID().toString().toLowerCase(Locale.ENGLISH);
|
||||
} else {
|
||||
// we do some basic validation if 'val' looks like an UUID
|
||||
if (val.length() != 36 || val.charAt(8) != DASH || val.charAt(13) != DASH
|
||||
|
@ -85,12 +86,12 @@ public class UUIDField extends FieldType {
|
|||
"Invalid UUID String: '" + val + "'");
|
||||
}
|
||||
|
||||
return val.toLowerCase();
|
||||
return val.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
|
||||
public String toInternal(UUID uuid) {
|
||||
return uuid.toString().toLowerCase();
|
||||
return uuid.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,6 +36,7 @@ import java.io.OutputStream;
|
|||
import java.io.PrintStream;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* An IndexWriter that is configured via Solr config mechanisms.
|
||||
|
@ -121,7 +122,7 @@ public class SolrIndexWriter extends IndexWriter {
|
|||
log.warn("No lockType configured for " + path + " assuming 'simple'");
|
||||
rawLockType = "simple";
|
||||
}
|
||||
final String lockType = rawLockType.toLowerCase().trim();
|
||||
final String lockType = rawLockType.toLowerCase(Locale.ENGLISH).trim();
|
||||
|
||||
if ("simple".equals(lockType)) {
|
||||
// multiple SimpleFSLockFactory instances should be OK
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.solr.client.solrj.beans;
|
|||
import org.apache.solr.common.SolrDocumentList;
|
||||
import org.apache.solr.common.SolrDocument;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -178,7 +179,7 @@ public class DocumentObjectBinder {
|
|||
} else {
|
||||
String setterName = setter.getName();
|
||||
if (setterName.startsWith("set") && setterName.length() > 3) {
|
||||
name = setterName.substring(3, 4).toLowerCase() + setterName.substring(4);
|
||||
name = setterName.substring(3, 4).toLowerCase(Locale.ENGLISH) + setterName.substring(4);
|
||||
} else {
|
||||
name = setter.getName();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.io.InputStream;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -187,7 +189,7 @@ public class XMLResponseParser extends ResponseParser
|
|||
{
|
||||
if( v != null ) {
|
||||
try {
|
||||
return KnownType.valueOf( v.toUpperCase() );
|
||||
return KnownType.valueOf( v.toUpperCase(Locale.ENGLISH) );
|
||||
}
|
||||
catch( Exception ex ) {}
|
||||
}
|
||||
|
@ -267,7 +269,7 @@ public class XMLResponseParser extends ResponseParser
|
|||
if( XMLStreamConstants.START_ELEMENT != parser.getEventType() ) {
|
||||
throw new RuntimeException( "must be start element, not: "+parser.getEventType() );
|
||||
}
|
||||
if( !"arr".equals( parser.getLocalName().toLowerCase() ) ) {
|
||||
if( !"arr".equals( parser.getLocalName().toLowerCase(Locale.ENGLISH) ) ) {
|
||||
throw new RuntimeException( "must be 'arr', not: "+parser.getLocalName() );
|
||||
}
|
||||
|
||||
|
@ -370,7 +372,7 @@ public class XMLResponseParser extends ResponseParser
|
|||
if( XMLStreamConstants.START_ELEMENT != parser.getEventType() ) {
|
||||
throw new RuntimeException( "must be start element, not: "+parser.getEventType() );
|
||||
}
|
||||
if( !"doc".equals( parser.getLocalName().toLowerCase() ) ) {
|
||||
if( !"doc".equals( parser.getLocalName().toLowerCase(Locale.ENGLISH) ) ) {
|
||||
throw new RuntimeException( "must be 'lst', not: "+parser.getLocalName() );
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import static org.junit.Assert.*;
|
|||
import javax.xml.xpath.XPathConstants;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Locale;
|
||||
|
||||
public class TestConfig extends SolrTestCaseJ4 {
|
||||
|
||||
|
@ -112,7 +113,7 @@ public class TestConfig extends SolrTestCaseJ4 {
|
|||
|
||||
//System.out.println( handler.getHiddenFiles() );
|
||||
// should not contain: <gettableFiles>solrconfig.xml scheam.xml admin-extra.html</gettableFiles>
|
||||
assertFalse(handler.getHiddenFiles().contains("scheam.xml".toUpperCase()));
|
||||
assertFalse(handler.getHiddenFiles().contains("scheam.xml".toUpperCase(Locale.ENGLISH)));
|
||||
assertTrue(handler.getHiddenFiles().contains("PROTWORDS.TXT"));
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.solr.util.AbstractSolrTestCase;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -49,7 +50,7 @@ public class TestBinaryResponseWriter extends AbstractSolrTestCase {
|
|||
* Tests known types implementation by asserting correct encoding/decoding of UUIDField
|
||||
*/
|
||||
public void testUUID() throws Exception {
|
||||
String s = UUID.randomUUID().toString().toLowerCase();
|
||||
String s = UUID.randomUUID().toString().toLowerCase(Locale.ENGLISH);
|
||||
assertU(adoc("id", "101", "uuid", s));
|
||||
assertU(commit());
|
||||
LocalSolrQueryRequest req = lrf.makeRequest("q", "*:*");
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Collection;
|
|||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -378,7 +379,7 @@ class StandardRequestParser implements SolrRequestParser
|
|||
public SolrParams parseParamsAndFillStreams(
|
||||
final HttpServletRequest req, ArrayList<ContentStream> streams ) throws Exception
|
||||
{
|
||||
String method = req.getMethod().toUpperCase();
|
||||
String method = req.getMethod().toUpperCase(Locale.ENGLISH);
|
||||
if( "GET".equals( method ) || "HEAD".equals( method )) {
|
||||
return new ServletSolrParams(req);
|
||||
}
|
||||
|
@ -389,7 +390,7 @@ class StandardRequestParser implements SolrRequestParser
|
|||
if( idx > 0 ) { // remove the charset definition "; charset=utf-8"
|
||||
contentType = contentType.substring( 0, idx );
|
||||
}
|
||||
if( "application/x-www-form-urlencoded".equals( contentType.toLowerCase() ) ) {
|
||||
if( "application/x-www-form-urlencoded".equals( contentType.toLowerCase(Locale.ENGLISH) ) ) {
|
||||
return new ServletSolrParams(req); // just get the params from parameterMap
|
||||
}
|
||||
if( ServletFileUpload.isMultipartContent(req) ) {
|
||||
|
|
|
@ -17,12 +17,14 @@
|
|||
|
||||
package org.apache.solr.servlet.cache;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum Method {
|
||||
GET, POST, HEAD, OTHER;
|
||||
|
||||
public static Method getMethod(String method) {
|
||||
try {
|
||||
return Method.valueOf(method.toUpperCase());
|
||||
return Method.valueOf(method.toUpperCase(Locale.ENGLISH));
|
||||
} catch (Exception e) {
|
||||
return OTHER;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
// is name a field name or a type name?
|
||||
String nt = request.getParameter("nt");
|
||||
if (nt==null || nt.length()==0) nt="name"; // assume field name
|
||||
nt = nt.toLowerCase().trim();
|
||||
nt = nt.toLowerCase(Locale.ENGLISH).trim();
|
||||
String name = request.getParameter("name");
|
||||
if (name==null || name.length()==0) name="";
|
||||
String val = request.getParameter("val");
|
||||
|
|
Loading…
Reference in New Issue