make Locale.ENGLISH/US -> ROOT for locale-independent operations, now that we are on java6

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4199@1358594 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-07-07 15:42:40 +00:00
parent 79cb46698e
commit b6a4748f21
94 changed files with 151 additions and 151 deletions

View File

@ -376,7 +376,7 @@ public class HunspellDictionary {
Arrays.sort(wordForm.getFlags());
entry = line.substring(0, flagSep);
if(ignoreCase) {
entry = entry.toLowerCase(Locale.ENGLISH);
entry = entry.toLowerCase(Locale.ROOT);
}
}

View File

@ -79,7 +79,7 @@ public class TestKeywordMarkerFilter extends BaseTokenStreamTestCase {
public boolean incrementToken() throws IOException {
if (input.incrementToken()) {
if (!keywordAttr.isKeyword()) {
final String term = termAtt.toString().toLowerCase(Locale.ENGLISH);
final String term = termAtt.toString().toLowerCase(Locale.ROOT);
termAtt.setEmpty().append(term);
}
return true;

View File

@ -27,7 +27,7 @@ import org.apache.lucene.analysis.MockTokenizer;
public class DateRecognizerSinkTokenizerTest extends BaseTokenStreamTestCase {
public void test() throws IOException {
DateRecognizerSinkFilter sinkFilter = new DateRecognizerSinkFilter(new SimpleDateFormat("MM/dd/yyyy", Locale.US));
DateRecognizerSinkFilter sinkFilter = new DateRecognizerSinkFilter(new SimpleDateFormat("MM/dd/yyyy", Locale.ROOT));
String test = "The quick red fox jumped over the lazy brown dogs on 7/11/2006 The dogs finally reacted on 7/12/2006";
TeeSinkTokenFilter tee = new TeeSinkTokenFilter(new MockTokenizer(new StringReader(test), MockTokenizer.WHITESPACE, false));
TeeSinkTokenFilter.SinkTokenStream sink = tee.newSinkTokenStream(sinkFilter);

View File

@ -36,7 +36,7 @@ public class TestCharArrayMap extends LuceneTestCase {
key[j] = (char)random().nextInt(127);
}
String keyStr = new String(key);
String hmapKey = ignoreCase ? keyStr.toLowerCase(Locale.ENGLISH) : keyStr;
String hmapKey = ignoreCase ? keyStr.toLowerCase(Locale.ROOT) : keyStr;
int val = random().nextInt();

View File

@ -123,11 +123,11 @@ public class GenerateJflexTLDMacros {
while (null != (line = reader.readLine())) {
Matcher matcher = TLD_PATTERN_1.matcher(line);
if (matcher.matches()) {
TLDs.add(matcher.group(1).toLowerCase(Locale.US));
TLDs.add(matcher.group(1).toLowerCase(Locale.ROOT));
} else {
matcher = TLD_PATTERN_2.matcher(line);
if (matcher.matches()) {
TLDs.add(matcher.group(1).toLowerCase(Locale.US));
TLDs.add(matcher.group(1).toLowerCase(Locale.ROOT));
}
}
}
@ -146,7 +146,7 @@ public class GenerateJflexTLDMacros {
*/
private void writeOutput(SortedSet<String> ASCIITLDs) throws IOException {
final DateFormat dateFormat = DateFormat.getDateTimeInstance
(DateFormat.FULL, DateFormat.FULL, Locale.US);
(DateFormat.FULL, DateFormat.FULL, Locale.ROOT);
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
final Writer writer = new OutputStreamWriter
(new FileOutputStream(outputFile), "UTF-8");

View File

@ -64,7 +64,7 @@ public class TestICUCollationKeyAnalyzer extends CollationTestBase {
//
public void testCollationKeySort() throws Exception {
Analyzer usAnalyzer = new ICUCollationKeyAnalyzer
(TEST_VERSION_CURRENT, Collator.getInstance(Locale.US));
(TEST_VERSION_CURRENT, Collator.getInstance(Locale.ROOT));
Analyzer franceAnalyzer = new ICUCollationKeyAnalyzer
(TEST_VERSION_CURRENT, Collator.getInstance(Locale.FRANCE));
Analyzer swedenAnalyzer = new ICUCollationKeyAnalyzer
@ -73,7 +73,7 @@ public class TestICUCollationKeyAnalyzer extends CollationTestBase {
(TEST_VERSION_CURRENT, Collator.getInstance(new Locale("da", "dk")));
// The ICU Collator and java.text.Collator implementations differ in their
// orderings - "BFJHD" is the ordering for the ICU Collator for Locale.US.
// orderings - "BFJHD" is the ordering for the ICU Collator for Locale.ROOT.
testCollationKeySort
(usAnalyzer, franceAnalyzer, swedenAnalyzer, denmarkAnalyzer,
"BFJHD", "ECAGI", "BJDFH", "BJDHF");

View File

@ -29,7 +29,7 @@ public class GenerateHTMLStripCharFilterSupplementaryMacros {
private static final UnicodeSet BMP = new UnicodeSet("[\u0000-\uFFFF]");
private static final String NL = System.getProperty("line.separator");
private static final DateFormat DATE_FORMAT = DateFormat.getDateTimeInstance
(DateFormat.FULL, DateFormat.FULL, Locale.US);
(DateFormat.FULL, DateFormat.FULL, Locale.ROOT);
static {
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
}

View File

@ -32,7 +32,7 @@ public class GenerateJFlexSupplementaryMacros {
private static final UnicodeSet BMP = new UnicodeSet("[\u0000-\uFFFF]");
private static final String NL = System.getProperty("line.separator");
private static final DateFormat DATE_FORMAT = DateFormat.getDateTimeInstance
(DateFormat.FULL, DateFormat.FULL, Locale.US);
(DateFormat.FULL, DateFormat.FULL, Locale.ROOT);
static {
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
}

View File

@ -65,7 +65,7 @@ public class StempelStemmer {
DataInputStream in = null;
try {
in = new DataInputStream(new BufferedInputStream(stemmerTable));
String method = in.readUTF().toUpperCase(Locale.ENGLISH);
String method = in.readUTF().toUpperCase(Locale.ROOT);
if (method.indexOf('M') < 0) {
return new org.egothor.stemmer.Trie(in);
} else {

View File

@ -163,7 +163,7 @@ public class DirContentSource extends ContentSource {
dfi = new DateFormatInfo();
dfi.pos = new ParsePosition(0);
// date format: 30-MAR-1987 14:22:36.87
dfi.df = new SimpleDateFormat("dd-MMM-yyyy kk:mm:ss.SSS", Locale.US);
dfi.df = new SimpleDateFormat("dd-MMM-yyyy kk:mm:ss.SSS", Locale.ROOT);
dfi.df.setLenient(true);
dateFormat.set(dfi);
}

View File

@ -182,7 +182,7 @@ public class DocMaker implements Closeable {
private boolean storeBytes = false;
private static class DateUtil {
public SimpleDateFormat parser = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss", Locale.US);
public SimpleDateFormat parser = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss", Locale.ROOT);
public Calendar cal = Calendar.getInstance();
public ParsePosition pos = new ParsePosition(0);
public DateUtil() {

View File

@ -35,7 +35,7 @@ public class LongToEnglishContentSource extends ContentSource{
}
// TODO: we could take param to specify locale...
private final RuleBasedNumberFormat rnbf = new RuleBasedNumberFormat(Locale.ENGLISH,
private final RuleBasedNumberFormat rnbf = new RuleBasedNumberFormat(Locale.ROOT,
RuleBasedNumberFormat.SPELLOUT);
@Override
public synchronized DocData getNextDocData(DocData docData) throws NoMoreDataException, IOException {

View File

@ -37,7 +37,7 @@ public class LongToEnglishQueryMaker implements QueryMaker {
protected QueryParser parser;
// TODO: we could take param to specify locale...
private final RuleBasedNumberFormat rnbf = new RuleBasedNumberFormat(Locale.ENGLISH,
private final RuleBasedNumberFormat rnbf = new RuleBasedNumberFormat(Locale.ROOT,
RuleBasedNumberFormat.SPELLOUT);
public Query makeQuery(int size) throws Exception {

View File

@ -76,7 +76,7 @@ public class ReutersContentSource extends ContentSource {
if (dfi == null) {
dfi = new DateFormatInfo();
// date format: 30-MAR-1987 14:22:36.87
dfi.df = new SimpleDateFormat("dd-MMM-yyyy kk:mm:ss.SSS",Locale.US);
dfi.df = new SimpleDateFormat("dd-MMM-yyyy kk:mm:ss.SSS",Locale.ROOT);
dfi.df.setLenient(true);
dfi.pos = new ParsePosition(0);
dateFormat.set(dfi);

View File

@ -108,7 +108,7 @@ public class TrecContentSource extends ContentSource {
dfi = new DateFormatInfo();
dfi.dfs = new SimpleDateFormat[DATE_FORMATS.length];
for (int i = 0; i < dfi.dfs.length; i++) {
dfi.dfs[i] = new SimpleDateFormat(DATE_FORMATS[i], Locale.US);
dfi.dfs[i] = new SimpleDateFormat(DATE_FORMATS[i], Locale.ROOT);
dfi.dfs[i].setLenient(true);
}
dfi.pos = new ParsePosition(0);

View File

@ -47,7 +47,7 @@ public abstract class TrecDocParser {
static final Map<String,ParsePathType> pathName2Type = new HashMap<String,ParsePathType>();
static {
for (ParsePathType ppt : ParsePathType.values()) {
pathName2Type.put(ppt.name().toUpperCase(Locale.ENGLISH),ppt);
pathName2Type.put(ppt.name().toUpperCase(Locale.ROOT),ppt);
}
}
@ -60,7 +60,7 @@ public abstract class TrecDocParser {
public static ParsePathType pathType(File f) {
int pathLength = 0;
while (f != null && ++pathLength < MAX_PATH_LENGTH) {
ParsePathType ppt = pathName2Type.get(f.getName().toUpperCase(Locale.ENGLISH));
ParsePathType ppt = pathName2Type.get(f.getName().toUpperCase(Locale.ROOT));
if (ppt!=null) {
return ppt;
}

View File

@ -227,7 +227,7 @@ InterruptedException {
Token t1, t2;
boolean inImg = false;
t1 = jj_consume_token(TagName);
String tagName = t1.image.toLowerCase(Locale.ENGLISH);
String tagName = t1.image.toLowerCase(Locale.ROOT);
if(Tags.WS_ELEMS.contains(tagName) ) {
addSpace();
}
@ -264,7 +264,7 @@ InterruptedException {
)
&& t2 != null)
{
currentMetaTag=t2.image.toLowerCase(Locale.ENGLISH);
currentMetaTag=t2.image.toLowerCase(Locale.ROOT);
if(currentMetaTag != null && currentMetaContent != null) {
addMetaTag();
}
@ -272,7 +272,7 @@ InterruptedException {
if(inMetaTag && t1.image.equalsIgnoreCase("content") && t2 !=
null)
{
currentMetaContent=t2.image.toLowerCase(Locale.ENGLISH);
currentMetaContent=t2.image.toLowerCase(Locale.ROOT);
if(currentMetaTag != null && currentMetaContent != null) {
addMetaTag();
}

View File

@ -227,7 +227,7 @@ void Tag() throws IOException :
}
{
t1=<TagName> {
String tagName = t1.image.toLowerCase(Locale.ENGLISH);
String tagName = t1.image.toLowerCase(Locale.ROOT);
if(Tags.WS_ELEMS.contains(tagName) ) {
addSpace();
}
@ -249,7 +249,7 @@ void Tag() throws IOException :
)
&& t2 != null)
{
currentMetaTag=t2.image.toLowerCase(Locale.ENGLISH);
currentMetaTag=t2.image.toLowerCase(Locale.ROOT);
if(currentMetaTag != null && currentMetaContent != null) {
addMetaTag();
}
@ -257,7 +257,7 @@ void Tag() throws IOException :
if(inMetaTag && t1.image.equalsIgnoreCase("content") && t2 !=
null)
{
currentMetaContent=t2.image.toLowerCase(Locale.ENGLISH);
currentMetaContent=t2.image.toLowerCase(Locale.ROOT);
if(currentMetaTag != null && currentMetaContent != null) {
addMetaTag();
}

View File

@ -77,7 +77,7 @@ public class SearchWithSortTask extends ReadTask {
} else {
throw new RuntimeException("You must specify the sort type ie page:int,subject:string");
}
sortField0 = new SortField(fieldName, SortField.Type.valueOf(typeString.toUpperCase(Locale.ENGLISH)));
sortField0 = new SortField(fieldName, SortField.Type.valueOf(typeString.toUpperCase(Locale.ROOT)));
}
sortFields[upto++] = sortField0;
}

View File

@ -99,7 +99,7 @@ public class StreamUtils {
String fileName = file.getName();
int idx = fileName.lastIndexOf('.');
if (idx != -1) {
type = extensionToType.get(fileName.substring(idx).toLowerCase(Locale.ENGLISH));
type = extensionToType.get(fileName.substring(idx).toLowerCase(Locale.ROOT));
}
return type==null ? Type.PLAIN : type;
}

View File

@ -53,7 +53,7 @@ public class DateTools {
private static final ThreadLocal<Calendar> TL_CAL = new ThreadLocal<Calendar>() {
@Override
protected Calendar initialValue() {
return Calendar.getInstance(GMT, Locale.US);
return Calendar.getInstance(GMT, Locale.ROOT);
}
};
@ -194,7 +194,7 @@ public class DateTools {
this.formatLen = formatLen;
// formatLen 10's place: 11111111
// formatLen 1's place: 12345678901234567
this.format = new SimpleDateFormat("yyyyMMddHHmmssSSS".substring(0,formatLen),Locale.US);
this.format = new SimpleDateFormat("yyyyMMddHHmmssSSS".substring(0,formatLen),Locale.ROOT);
this.format.setTimeZone(GMT);
}
@ -202,7 +202,7 @@ public class DateTools {
* in lowercase (for backwards compatibility) */
@Override
public String toString() {
return super.toString().toLowerCase(Locale.ENGLISH);
return super.toString().toLowerCase(Locale.ROOT);
}
}

View File

@ -559,7 +559,7 @@ public final class RamUsageEstimator {
*/
public static String humanReadableUnits(long bytes) {
return humanReadableUnits(bytes,
new DecimalFormat("0.#", DecimalFormatSymbols.getInstance(Locale.ENGLISH)));
new DecimalFormat("0.#", DecimalFormatSymbols.getInstance(Locale.ROOT)));
}
/**

View File

@ -73,7 +73,7 @@ public enum Version {
}
public static Version parseLeniently(String version) {
String parsedMatchVersion = version.toUpperCase(Locale.ENGLISH);
String parsedMatchVersion = version.toUpperCase(Locale.ROOT);
return Version.valueOf(parsedMatchVersion.replaceFirst("^(\\d)\\.(\\d)$", "LUCENE_$1$2"));
}
}

View File

@ -159,7 +159,7 @@ public class TestCharTermAttributeImpl extends LuceneTestCase {
public void testAppendableInterface() {
CharTermAttributeImpl t = new CharTermAttributeImpl();
Formatter formatter = new Formatter(t, Locale.US);
Formatter formatter = new Formatter(t, Locale.ROOT);
formatter.format("%d", 1234);
assertEquals("1234", t.toString());
formatter.format("%d", 5678);

View File

@ -71,7 +71,7 @@ public class Test10KPulsings extends LuceneTestCase {
Field field = newField("field", "", ft);
document.add(field);
NumberFormat df = new DecimalFormat("00000", new DecimalFormatSymbols(Locale.ENGLISH));
NumberFormat df = new DecimalFormat("00000", new DecimalFormatSymbols(Locale.ROOT));
for (int i = 0; i < 10050; i++) {
field.setStringValue(df.format(i));
@ -122,7 +122,7 @@ public class Test10KPulsings extends LuceneTestCase {
Field field = newField("field", "", ft);
document.add(field);
NumberFormat df = new DecimalFormat("00000", new DecimalFormatSymbols(Locale.ENGLISH));
NumberFormat df = new DecimalFormat("00000", new DecimalFormatSymbols(Locale.ROOT));
final int freq = freqCutoff + 1;

View File

@ -180,7 +180,7 @@ public class TestDateTools extends LuceneTestCase {
}
private String isoFormat(Date date) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS", Locale.US);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS", Locale.ROOT);
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
return sdf.format(date);
}

View File

@ -44,7 +44,7 @@ public class TestMultiValuedNumericRangeQuery extends LuceneTestCase {
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()))
.setMaxBufferedDocs(_TestUtil.nextInt(random(), 50, 1000)));
DecimalFormat format = new DecimalFormat("00000000000", new DecimalFormatSymbols(Locale.US));
DecimalFormat format = new DecimalFormat("00000000000", new DecimalFormatSymbols(Locale.ROOT));
int num = atLeast(500);
for (int l = 0; l < num; l++) {

View File

@ -58,7 +58,7 @@ public class TestRegexpRandom extends LuceneTestCase {
Field field = newField("field", "", customType);
doc.add(field);
NumberFormat df = new DecimalFormat("000", new DecimalFormatSymbols(Locale.ENGLISH));
NumberFormat df = new DecimalFormat("000", new DecimalFormatSymbols(Locale.ROOT));
for (int i = 0; i < 1000; i++) {
field.setStringValue(df.format(i));
writer.addDocument(doc);

View File

@ -54,7 +54,7 @@ public class TestWildcardRandom extends LuceneTestCase {
Field field = newStringField("field", "", Field.Store.NO);
doc.add(field);
NumberFormat df = new DecimalFormat("000", new DecimalFormatSymbols(Locale.ENGLISH));
NumberFormat df = new DecimalFormat("000", new DecimalFormatSymbols(Locale.ROOT));
for (int i = 0; i < 1000; i++) {
field.setStringValue(df.format(i));
writer.addDocument(doc);

View File

@ -59,7 +59,7 @@ public class StressRamUsageEstimator extends LuceneTestCase {
// Check the current memory consumption and provide the estimate.
long jvmUsed = memoryMXBean.getHeapMemoryUsage().getUsed();
long estimated = RamUsageEstimator.sizeOf(first);
System.out.println(String.format(Locale.ENGLISH, "%10d, %10d",
System.out.println(String.format(Locale.ROOT, "%10d, %10d",
jvmUsed, estimated));
// Make a batch of objects.
@ -125,7 +125,7 @@ public class StressRamUsageEstimator extends LuceneTestCase {
break;
}
System.out.println(String.format(Locale.ENGLISH, "%10s\t%10s\t%10s",
System.out.println(String.format(Locale.ROOT, "%10s\t%10s\t%10s",
RamUsageEstimator.humanReadableUnits(mu.getUsed()),
RamUsageEstimator.humanReadableUnits(mu.getMax()),
RamUsageEstimator.humanReadableUnits(estimated)));

View File

@ -1298,7 +1298,7 @@ public class TestFSTs extends LuceneTestCase {
ord++;
if (ord % 500000 == 0) {
System.out.println(
String.format(Locale.ENGLISH,
String.format(Locale.ROOT,
"%6.2fs: %9d...", ((System.currentTimeMillis() - tStart) / 1000.0), ord));
}
if (ord >= limit) {

View File

@ -30,7 +30,7 @@ public class BreakIteratorBoundaryScannerTest extends LuceneTestCase {
public void testOutOfRange() throws Exception {
StringBuilder text = new StringBuilder(TEXT);
BreakIterator bi = BreakIterator.getWordInstance(Locale.ENGLISH);
BreakIterator bi = BreakIterator.getWordInstance(Locale.ROOT);
BoundaryScanner scanner = new BreakIteratorBoundaryScanner(bi);
int start = TEXT.length() + 1;
@ -44,7 +44,7 @@ public class BreakIteratorBoundaryScannerTest extends LuceneTestCase {
public void testWordBoundary() throws Exception {
StringBuilder text = new StringBuilder(TEXT);
BreakIterator bi = BreakIterator.getWordInstance(Locale.ENGLISH);
BreakIterator bi = BreakIterator.getWordInstance(Locale.ROOT);
BoundaryScanner scanner = new BreakIteratorBoundaryScanner(bi);
int start = TEXT.indexOf("formance");

View File

@ -183,7 +183,7 @@ public class ChainedFilterTest extends LuceneTestCase {
/*
private Date parseDate(String s) throws ParseException {
return new SimpleDateFormat("yyyy MMM dd", Locale.US).parse(s);
return new SimpleDateFormat("yyyy MMM dd", Locale.ROOT).parse(s);
}
*/

View File

@ -91,7 +91,7 @@ public class NumericQueryNode extends QueryNodeImpl implements
*/
protected CharSequence getTermEscaped(EscapeQuerySyntax escaper) {
return escaper.escape(NumberFormat.getNumberInstance().format(this.value),
Locale.ENGLISH, Type.NORMAL);
Locale.ROOT, Type.NORMAL);
}
public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser) {

View File

@ -122,7 +122,7 @@ public class BBoxStrategy extends SpatialStrategy {
ff.setIndexOptions(IndexOptions.DOCS_ONLY);
ff.freeze();
NumberFormat nf = NumberFormat.getInstance( Locale.US );
NumberFormat nf = NumberFormat.getInstance( Locale.ROOT );
nf.setMaximumFractionDigits( 5 );
nf.setMinimumFractionDigits( 5 );
nf.setGroupingUsed(false);

View File

@ -61,14 +61,14 @@ public class SpatialOperation implements Serializable {
this.sourceNeedsArea = sourceNeedsArea;
this.targetNeedsArea = targetNeedsArea;
registry.put(name, this);
registry.put(name.toUpperCase(Locale.US), this);
registry.put(name.toUpperCase(Locale.ROOT), this);
list.add( this );
}
public static SpatialOperation get( String v ) {
SpatialOperation op = registry.get( v );
if( op == null ) {
op = registry.get(v.toUpperCase(Locale.US));
op = registry.get(v.toUpperCase(Locale.ROOT));
}
if( op == null ) {
throw new InvalidSpatialArgument("Unknown Operation: " + v );

View File

@ -320,7 +320,7 @@ public class DirectSpellChecker {
return new SuggestWord[0];
if (lowerCaseTerms) {
term = new Term(term.field(), text.toLowerCase(Locale.ENGLISH));
term = new Term(term.field(), text.toLowerCase(Locale.ROOT));
}
int docfreq = ir.docFreq(term);

View File

@ -132,7 +132,7 @@ public final class Sort {
@Override
public String toString() {
return String.format(Locale.ENGLISH,
return String.format(Locale.ROOT,
"time=%.2f sec. total (%.2f reading, %.2f sorting, %.2f merging), lines=%d, temp files=%d, merges=%d, soft ram limit=%.2f MB",
totalTime / 1000.0d, readTime / 1000.0d, sortTime / 1000.0d, mergeTime / 1000.0d,
lines, tempMergeFiles, mergeRounds,

View File

@ -47,7 +47,7 @@ final class Average
public String toString()
{
return String.format(Locale.ENGLISH, "%.0f [+- %.2f]",
return String.format(Locale.ROOT, "%.0f [+- %.2f]",
avg, stddev);
}

View File

@ -119,7 +119,7 @@ public class LookupBenchmarkTest extends LuceneTestCase {
});
System.err.println(
String.format(Locale.ENGLISH, "%-15s input: %d, time[ms]: %s",
String.format(Locale.ROOT, "%-15s input: %d, time[ms]: %s",
cls.getSimpleName(),
dictionaryInput.length,
result.average.toString()));
@ -134,7 +134,7 @@ public class LookupBenchmarkTest extends LuceneTestCase {
for (Class<? extends Lookup> cls : benchmarkClasses) {
Lookup lookup = buildLookup(cls, dictionaryInput);
System.err.println(
String.format(Locale.ENGLISH, "%-15s size[B]:%,13d",
String.format(Locale.ROOT, "%-15s size[B]:%,13d",
lookup.getClass().getSimpleName(),
RamUsageEstimator.sizeOf(lookup)));
}
@ -181,7 +181,7 @@ public class LookupBenchmarkTest extends LuceneTestCase {
*/
public void runPerformanceTest(final int minPrefixLen, final int maxPrefixLen,
final int num, final boolean onlyMorePopular) throws Exception {
System.err.println(String.format(Locale.ENGLISH,
System.err.println(String.format(Locale.ROOT,
"-- prefixes: %d-%d, num: %d, onlyMorePopular: %s",
minPrefixLen, maxPrefixLen, num, onlyMorePopular));
@ -206,7 +206,7 @@ public class LookupBenchmarkTest extends LuceneTestCase {
});
System.err.println(
String.format(Locale.ENGLISH, "%-15s queries: %d, time[ms]: %s, ~kQPS: %.0f",
String.format(Locale.ROOT, "%-15s queries: %d, time[ms]: %s, ~kQPS: %.0f",
lookup.getClass().getSimpleName(),
input.size(),
result.average.toString(),

View File

@ -233,9 +233,9 @@ public class FSTCompletionTest extends LuceneTestCase {
StringBuilder b = new StringBuilder();
String format = "%" + colLen + "s " + "%" + colLen + "s\n";
b.append(String.format(Locale.ENGLISH, format, "Expected", "Result"));
b.append(String.format(Locale.ROOT, format, "Expected", "Result"));
for (int i = 0; i < Math.max(result.length, expected.length); i++) {
b.append(String.format(Locale.ENGLISH, format,
b.append(String.format(Locale.ROOT, format,
i < expected.length ? expected[i] : "--",
i < result.length ? result[i] : "--"));
}

View File

@ -71,7 +71,7 @@ public class RandomCodec extends Lucene40Codec {
codec = formats.get(Math.abs(perFieldSeed ^ name.hashCode()) % formats.size());
if (codec instanceof SimpleTextPostingsFormat && perFieldSeed % 5 != 0) {
// make simpletext rarer, choose again
codec = formats.get(Math.abs(perFieldSeed ^ name.toUpperCase(Locale.ENGLISH).hashCode()) % formats.size());
codec = formats.get(Math.abs(perFieldSeed ^ name.toUpperCase(Locale.ROOT).hashCode()) % formats.size());
}
previousMappings.put(name, codec);
// Safety:

View File

@ -357,7 +357,7 @@ public class CheckHits {
// - end with one of: "product of:", "sum of:", "max of:", or
// - have "max plus <x> times others" (where <x> is float).
float x = 0;
String descr = expl.getDescription().toLowerCase(Locale.ENGLISH);
String descr = expl.getDescription().toLowerCase(Locale.ROOT);
boolean productOf = descr.endsWith("product of:");
boolean sumOf = descr.endsWith("sum of:");
boolean maxOf = descr.endsWith("max of:");

View File

@ -39,7 +39,7 @@ final class TestRuleIcuHack implements TestRule {
if (!icuTested.getAndSet(true)) {
Locale previous = Locale.getDefault();
try {
Locale.setDefault(Locale.US);
Locale.setDefault(Locale.ROOT);
Class.forName("com.ibm.icu.util.ULocale");
} catch (ClassNotFoundException cnfe) {
// ignore if no ICU is in classpath

View File

@ -168,7 +168,7 @@ public class ForbiddenApisCheckTask extends Task {
violations[0]++;
final StringBuilder sb = new StringBuilder(" in ").append(className);
if (source != null && lineNo >= 0) {
new Formatter(sb, Locale.ENGLISH).format(" (%s:%d)", source, lineNo).flush();
new Formatter(sb, Locale.ROOT).format(" (%s:%d)", source, lineNo).flush();
}
log(sb.toString(), Project.MSG_ERR);
}
@ -251,7 +251,7 @@ public class ForbiddenApisCheckTask extends Task {
checked++;
}
log(String.format(Locale.ENGLISH,
log(String.format(Locale.ROOT,
"Scanned %d class file(s) for forbidden method invocations (in %.2fs), %d error(s).",
checked, (System.currentTimeMillis() - start) / 1000.0, errors),
errors > 0 ? Project.MSG_ERR : Project.MSG_INFO);

View File

@ -140,7 +140,7 @@ public class LicenseCheckTask extends Task {
checked++;
}
log(String.format(Locale.ENGLISH,
log(String.format(Locale.ROOT,
"Scanned %d JAR file(s) for licenses (in %.2fs.), %d error(s).",
checked, (System.currentTimeMillis() - start) / 1000.0, errors),
errors > 0 ? Project.MSG_ERR : Project.MSG_INFO);
@ -255,7 +255,7 @@ outer:
private static final String createChecksumString(byte[] digest) {
StringBuilder checksum = new StringBuilder();
for (int i = 0; i < digest.length; i++) {
checksum.append(String.format(Locale.ENGLISH, "%02x",
checksum.append(String.format(Locale.ROOT, "%02x",
CHECKSUM_BYTE_MASK & digest[i]));
}
return checksum.toString();

View File

@ -69,7 +69,7 @@ public class MorfologikFilterFactory extends TokenFilterFactory {
String dictionaryName = args.get(DICTIONARY_SCHEMA_ATTRIBUTE);
if (dictionaryName != null && !dictionaryName.isEmpty()) {
try {
DICTIONARY dictionary = DICTIONARY.valueOf(dictionaryName.toUpperCase(Locale.ENGLISH));
DICTIONARY dictionary = DICTIONARY.valueOf(dictionaryName.toUpperCase(Locale.ROOT));
assert dictionary != null;
this.dictionary = dictionary;
} catch (IllegalArgumentException e) {

View File

@ -171,7 +171,7 @@ public class MailEntityProcessor extends EntityProcessorBase {
InputStream is = part.getInputStream();
String fileName = part.getFileName();
Metadata md = new Metadata();
md.set(HttpHeaders.CONTENT_TYPE, ctype.getBaseType().toLowerCase(Locale.ENGLISH));
md.set(HttpHeaders.CONTENT_TYPE, ctype.getBaseType().toLowerCase(Locale.ROOT));
md.set(TikaMetadataKeys.RESOURCE_NAME_KEY, fileName);
String content = tika.parseToString(is, md);
if (disp != null && disp.equalsIgnoreCase(Part.ATTACHMENT)) {

View File

@ -128,7 +128,7 @@ public class DataImporter {
private void loadSchemaFieldMap() {
Map<String, SchemaField> modLnvsf = new HashMap<String, SchemaField>();
for (Map.Entry<String, SchemaField> entry : schema.getFields().entrySet()) {
modLnvsf.put(entry.getKey().toLowerCase(Locale.ENGLISH), entry.getValue());
modLnvsf.put(entry.getKey().toLowerCase(Locale.ROOT), entry.getValue());
}
lowerNameVsSchemaField = Collections.unmodifiableMap(modLnvsf);
}
@ -139,7 +139,7 @@ public class DataImporter {
schemaField = schema.getFieldOrNull(caseInsensitiveName);
}
if (schemaField == null) {
schemaField = lowerNameVsSchemaField.get(caseInsensitiveName.toLowerCase(Locale.ENGLISH));
schemaField = lowerNameVsSchemaField.get(caseInsensitiveName.toLowerCase(Locale.ROOT));
}
return schemaField;
}

View File

@ -72,7 +72,7 @@ public class NumberFormatTransformer extends Transformer {
}
Object val = row.get(srcCol);
String styleSmall = style.toLowerCase(Locale.ENGLISH);
String styleSmall = style.toLowerCase(Locale.ROOT);
if (val instanceof List) {
List<String> inputs = (List) val;

View File

@ -108,7 +108,7 @@ public class TestCachedSqlEntityProcessor extends AbstractDataImportHandlerTestC
if (r == null)
break;
rows.add(r);
assertEquals(r.get("desc").toString().toUpperCase(Locale.ENGLISH), r.get("desc"));
assertEquals(r.get("desc").toString().toUpperCase(Locale.ROOT), r.get("desc"));
}
assertEquals(2, rows.size());
assertEquals(2, rows.get(0).size());
@ -176,7 +176,7 @@ public class TestCachedSqlEntityProcessor extends AbstractDataImportHandlerTestC
Object val = entry.getValue();
if (val instanceof String) {
String s = (String) val;
entry.setValue(s.toUpperCase(Locale.ENGLISH));
entry.setValue(s.toUpperCase(Locale.ROOT));
}
}
return row;

View File

@ -138,7 +138,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(Locale.ENGLISH));
MediaType mt = MediaType.parse(streamType.trim().toLowerCase(Locale.ROOT));
parser = new DefaultParser(config.getMediaTypeRegistry()).getParsers().get(mt);
} else {
parser = autoDetectParser;

View File

@ -93,7 +93,7 @@ public class JapaneseTokenizerFactory extends TokenizerFactory implements Resour
private Mode getMode(Map<String, String> args) {
String mode = args.get(MODE);
if (mode != null) {
return Mode.valueOf(mode.toUpperCase(Locale.ENGLISH));
return Mode.valueOf(mode.toUpperCase(Locale.ROOT));
} else {
return JapaneseTokenizer.DEFAULT_MODE;
}

View File

@ -68,12 +68,12 @@ public class PhoneticFilterFactory extends TokenFilterFactory
private static final Map<String, Class<? extends Encoder>> registry = new HashMap<String, Class<? extends Encoder>>(6);
static {
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);
registry.put("Caverphone".toUpperCase(Locale.ENGLISH), Caverphone2.class);
registry.put("ColognePhonetic".toUpperCase(Locale.ENGLISH), ColognePhonetic.class);
registry.put("DoubleMetaphone".toUpperCase(Locale.ROOT), DoubleMetaphone.class);
registry.put("Metaphone".toUpperCase(Locale.ROOT), Metaphone.class);
registry.put("Soundex".toUpperCase(Locale.ROOT), Soundex.class);
registry.put("RefinedSoundex".toUpperCase(Locale.ROOT), RefinedSoundex.class);
registry.put("Caverphone".toUpperCase(Locale.ROOT), Caverphone2.class);
registry.put("ColognePhonetic".toUpperCase(Locale.ROOT), ColognePhonetic.class);
}
protected boolean inject = true;
@ -93,7 +93,7 @@ public class PhoneticFilterFactory extends TokenFilterFactory
throw new InitializationException("Missing required parameter: " + ENCODER
+ " [" + registry.keySet() + "]");
}
clazz = registry.get(name.toUpperCase(Locale.ENGLISH));
clazz = registry.get(name.toUpperCase(Locale.ROOT));
if( clazz == null ) {
clazz = resolveEncoder(name);
}

View File

@ -198,7 +198,7 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
log.warn("No lockType configured for " + dir + " assuming 'simple'");
rawLockType = "simple";
}
final String lockType = rawLockType.toLowerCase(Locale.ENGLISH).trim();
final String lockType = rawLockType.toLowerCase(Locale.ROOT).trim();
if ("simple".equals(lockType)) {
// multiple SimpleFSLockFactory instances should be OK

View File

@ -781,7 +781,7 @@ public class CoreContainer
if (schemaFile.exists()) {
String key = schemaFile.getAbsolutePath()
+ ":"
+ new SimpleDateFormat("yyyyMMddHHmmss", Locale.US).format(new Date(
+ new SimpleDateFormat("yyyyMMddHHmmss", Locale.ROOT).format(new Date(
schemaFile.lastModified()));
schema = indexSchemaCache.get(key);
if (schema == null) {

View File

@ -281,7 +281,7 @@ public class JmxMonitoredMap<K, V> extends
} else if (staticStats.contains(attribute) && attribute != null
&& attribute.length() > 0) {
try {
String getter = "get" + attribute.substring(0, 1).toUpperCase(Locale.ENGLISH)
String getter = "get" + attribute.substring(0, 1).toUpperCase(Locale.ROOT)
+ attribute.substring(1);
Method meth = infoBean.getClass().getMethod(getter);
val = meth.invoke(infoBean);

View File

@ -344,7 +344,7 @@ public class SolrConfig extends Config {
/** Input must not be null */
public static LastModFrom parse(final String s) {
try {
return valueOf(s.toUpperCase(Locale.ENGLISH));
return valueOf(s.toUpperCase(Locale.ROOT));
} catch (Exception e) {
log.warn( "Unrecognized value for lastModFrom: " + s, e);
return BOGUS;

View File

@ -1913,13 +1913,13 @@ public final class SolrCore implements SolrInfoMBean {
Set<String> hide = new HashSet<String>();
for (String file : solrConfig.getResourceLoader().listConfigDir()) {
hide.add(file.toUpperCase(Locale.ENGLISH));
hide.add(file.toUpperCase(Locale.ROOT));
}
// except the "gettable" list
StringTokenizer st = new StringTokenizer( gettable );
while( st.hasMoreTokens() ) {
hide.remove( st.nextToken().toUpperCase(Locale.ENGLISH) );
hide.remove( st.nextToken().toUpperCase(Locale.ROOT) );
}
for( String s : hide ) {
invariants.add( ShowFileRequestHandler.HIDDEN, s );

View File

@ -145,7 +145,7 @@ public class SolrDeletionPolicy implements IndexDeletionPolicy, NamedListInitial
try {
if (maxCommitAge != null) {
if (maxCommitAgeTimeStamp==-1) {
DateMathParser dmp = new DateMathParser(DateField.UTC, Locale.US);
DateMathParser dmp = new DateMathParser(DateField.UTC, Locale.ROOT);
maxCommitAgeTimeStamp = dmp.parseMath(maxCommitAge).getTime();
}
if (IndexDeletionPolicyWrapper.getCommitTimestamp(commit) < maxCommitAgeTimeStamp) {

View File

@ -191,7 +191,7 @@ public class PingRequestHandler extends RequestHandlerBase implements SolrCoreAw
}
else {
try {
action = ACTIONS.valueOf(actionParam.toUpperCase(Locale.ENGLISH));
action = ACTIONS.valueOf(actionParam.toUpperCase(Locale.ROOT));
}
catch (IllegalArgumentException iae){
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,

View File

@ -530,7 +530,7 @@ public class SnapPuller {
* All the files are copied to a temp dir first
*/
private File createTempindexDir(SolrCore core) {
String tmpIdxDirName = "index." + new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.US).format(new Date());
String tmpIdxDirName = "index." + new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.ROOT).format(new Date());
File tmpIdxDir = new File(core.getDataDir(), tmpIdxDirName);
tmpIdxDir.mkdirs();
return tmpIdxDir;
@ -713,7 +713,7 @@ public class SnapPuller {
}
private String getDateAsStr(Date d) {
return new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.US).format(d);
return new SimpleDateFormat(SnapShooter.DATE_FMT, Locale.ROOT).format(d);
}
/**

View File

@ -91,7 +91,7 @@ public class SnapShooter {
if(numberToKeep<Integer.MAX_VALUE) {
deleteOldBackups(numberToKeep);
}
SimpleDateFormat fmt = new SimpleDateFormat(DATE_FMT, Locale.US);
SimpleDateFormat fmt = new SimpleDateFormat(DATE_FMT, Locale.ROOT);
directoryName = "snapshot." + fmt.format(new Date());
lock = lockFactory.makeLock(directoryName + ".lock");
if (lock.isLocked()) return;

View File

@ -101,7 +101,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase
String[] hidden = invariants.getParams( HIDDEN );
if( hidden != null ) {
for( String s : hidden ) {
hiddenFiles.add( s.toUpperCase(Locale.ENGLISH) );
hiddenFiles.add( s.toUpperCase(Locale.ROOT) );
}
}
}
@ -138,7 +138,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase
adminFile = confPath;
} else {
fname = fname.replace('\\', '/'); // normalize slashes
if (hiddenFiles.contains(fname.toUpperCase(Locale.ENGLISH))) {
if (hiddenFiles.contains(fname.toUpperCase(Locale.ROOT))) {
throw new SolrException(ErrorCode.FORBIDDEN, "Can not access: " + fname);
}
if (fname.indexOf("..") >= 0) {
@ -159,7 +159,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase
NamedList<SimpleOrderedMap<Object>> files = new SimpleOrderedMap<SimpleOrderedMap<Object>>();
for (String f : children) {
if (hiddenFiles.contains(f.toUpperCase(Locale.ENGLISH))) {
if (hiddenFiles.contains(f.toUpperCase(Locale.ROOT))) {
continue; // don't show 'hidden' files
}
if (f.startsWith(".")) {
@ -214,7 +214,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase
}
else {
fname = fname.replace( '\\', '/' ); // normalize slashes
if( hiddenFiles.contains( fname.toUpperCase(Locale.ENGLISH) ) ) {
if( hiddenFiles.contains( fname.toUpperCase(Locale.ROOT) ) ) {
throw new SolrException( ErrorCode.FORBIDDEN, "Can not access: "+fname );
}
if( fname.indexOf( ".." ) >= 0 ) {
@ -241,7 +241,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(Locale.ENGLISH) ) ) {
if( hiddenFiles.contains( path.toUpperCase(Locale.ROOT) ) ) {
continue; // don't show 'hidden' files
}
if( f.isHidden() || f.getName().startsWith( "." ) ) {

View File

@ -255,9 +255,9 @@ public class SolrInfoMBeanHandler extends RequestHandlerBase {
.append(ref).append(", Now: ").append(now);
if(ref instanceof Number) {
NumberFormat nf = NumberFormat.getIntegerInstance(Locale.ENGLISH);
NumberFormat nf = NumberFormat.getIntegerInstance(Locale.ROOT);
if((ref instanceof Double) || (ref instanceof Float)) {
nf = NumberFormat.getInstance(Locale.ENGLISH);
nf = NumberFormat.getInstance(Locale.ROOT);
}
double dref = ((Number)ref).doubleValue();
double dnow = ((Number)now).doubleValue();

View File

@ -131,7 +131,7 @@ public class SystemInfoHandler extends RequestHandlerBase
addGetterIfAvaliable( os, "maxFileDescriptorCount", info );
try {
if( !os.getName().toLowerCase(Locale.ENGLISH).startsWith( "windows" ) ) {
if( !os.getName().toLowerCase(Locale.ROOT).startsWith( "windows" ) ) {
// Try some command line things
info.add( "uname", execute( "uname -a" ) );
info.add( "uptime", execute( "uptime" ) );

View File

@ -242,7 +242,7 @@ public class TermsComponent extends SearchComponent {
int flags = 0;
for (String flagParam : flagParams) {
try {
flags |= TermsParams.TermsRegexpFlag.valueOf(flagParam.toUpperCase(Locale.ENGLISH)).getValue();
flags |= TermsParams.TermsRegexpFlag.valueOf(flagParam.toUpperCase(Locale.ROOT)).getValue();
} catch (IllegalArgumentException iae) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown terms regex flag '" + flagParam + "'");
}

View File

@ -127,7 +127,7 @@ public class DateField extends PrimitiveFieldType {
* Fixed Locale needed for parsing/formating Milliseconds in the
* canonical representation.
*/
protected static final Locale CANONICAL_LOCALE = Locale.US;
protected static final Locale CANONICAL_LOCALE = Locale.ROOT;
// The XML (external) date format will sort correctly, except if
// fractions of seconds are present (because '.' is lower than 'Z').

View File

@ -96,7 +96,7 @@ public class TrieField extends PrimitiveFieldType {
if (t != null) {
try {
type = TrieTypes.valueOf(t.toUpperCase(Locale.ENGLISH));
type = TrieTypes.valueOf(t.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Invalid type specified in schema.xml for field: " + args.get("name"), e);

View File

@ -70,7 +70,7 @@ public class UUIDField extends StrField {
@Override
public String toInternal(String val) {
if (val == null || 0==val.length() || NEW.equals(val)) {
return UUID.randomUUID().toString().toLowerCase(Locale.ENGLISH);
return UUID.randomUUID().toString().toLowerCase(Locale.ROOT);
} else {
// we do some basic validation if 'val' looks like an UUID
if (val.length() != 36 || val.charAt(8) != DASH || val.charAt(13) != DASH
@ -79,12 +79,12 @@ public class UUIDField extends StrField {
"Invalid UUID String: '" + val + "'");
}
return val.toLowerCase(Locale.ENGLISH);
return val.toLowerCase(Locale.ROOT);
}
}
public String toInternal(UUID uuid) {
return uuid.toString().toLowerCase(Locale.ENGLISH);
return uuid.toString().toLowerCase(Locale.ROOT);
}
@Override

View File

@ -379,7 +379,7 @@ class StandardRequestParser implements SolrRequestParser
public SolrParams parseParamsAndFillStreams(
final HttpServletRequest req, ArrayList<ContentStream> streams ) throws Exception
{
String method = req.getMethod().toUpperCase(Locale.ENGLISH);
String method = req.getMethod().toUpperCase(Locale.ROOT);
if( "GET".equals( method ) || "HEAD".equals( method )) {
return new ServletSolrParams(req);
}
@ -390,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(Locale.ENGLISH) ) ) {
if( "application/x-www-form-urlencoded".equals( contentType.toLowerCase(Locale.ROOT) ) ) {
return new ServletSolrParams(req); // just get the params from parameterMap
}
if( ServletFileUpload.isMultipartContent(req) ) {

View File

@ -24,7 +24,7 @@ public enum Method {
public static Method getMethod(String method) {
try {
return Method.valueOf(method.toUpperCase(Locale.ENGLISH));
return Method.valueOf(method.toUpperCase(Locale.ROOT));
} catch (Exception e) {
return OTHER;
}

View File

@ -756,7 +756,7 @@ public class UpdateLog implements PluginInfoInitialized {
private void ensureLog() {
if (tlog == null) {
String newLogName = String.format(Locale.ENGLISH, LOG_FILENAME_PATTERN, TLOG_NAME, id);
String newLogName = String.format(Locale.ROOT, LOG_FILENAME_PATTERN, TLOG_NAME, id);
tlog = new TransactionLog(new File(tlogDir, newLogName), globalStrings);
}
}

View File

@ -59,7 +59,7 @@ public class UUIDUpdateProcessorFactory
UpdateRequestProcessor next ) {
return new DefaultValueUpdateProcessor(fieldName, next) {
public Object getDefaultValue() {
return UUID.randomUUID().toString().toLowerCase(Locale.ENGLISH);
return UUID.randomUUID().toString().toLowerCase(Locale.ROOT);
}
};
}

View File

@ -83,8 +83,8 @@ public class DateMathParser {
/** Default TimeZone for DateMath rounding (UTC) */
public static final TimeZone DEFAULT_MATH_TZ = UTC;
/** Default Locale for DateMath rounding (Locale.US) */
public static final Locale DEFAULT_MATH_LOCALE = Locale.US;
/** Default Locale for DateMath rounding (Locale.ROOT) */
public static final Locale DEFAULT_MATH_LOCALE = Locale.ROOT;
/**
* A mapping from (uppercased) String labels idenyifying time units,

View File

@ -169,11 +169,11 @@ public class TestTrie extends SolrTestCaseJ4 {
assertQ("Range filter tint:[* to *] must match 10 documents", req("q", "*:*", "fq", "tdate:[* TO *]"), "//*[@numFound='10']");
// Test date math syntax
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ROOT);
format.setTimeZone(TimeZone.getTimeZone("UTC"));
assertU(delQ("*:*"));
DateMathParser dmp = new DateMathParser(DateField.UTC, Locale.US);
DateMathParser dmp = new DateMathParser(DateField.UTC, Locale.ROOT);
String largestDate = "";
for (int i = 0; i < 10; i++) {
// index 10 days starting with today
@ -220,9 +220,9 @@ public class TestTrie extends SolrTestCaseJ4 {
checkPrecisionSteps("tdate");
// For tdate tests
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ROOT);
format.setTimeZone(TimeZone.getTimeZone("UTC"));
DateMathParser dmp = new DateMathParser(DateField.UTC, Locale.US);
DateMathParser dmp = new DateMathParser(DateField.UTC, Locale.ROOT);
for (int i = 0; i < 10; i++) {
long l = Integer.MAX_VALUE + i*1L;

View File

@ -109,7 +109,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(Locale.ENGLISH)));
assertFalse(handler.getHiddenFiles().contains("scheam.xml".toUpperCase(Locale.ROOT)));
assertTrue(handler.getHiddenFiles().contains("PROTWORDS.TXT"));
}

View File

@ -174,7 +174,7 @@ public class StatsComponentTest extends AbstractSolrTestCase {
public void testFieldStatisticsResultsDateField() throws Exception {
SolrCore core = h.getCore();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US);
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ROOT);
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
String date1 = dateFormat.format(new Date(123456789)) + "Z";

View File

@ -55,7 +55,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(Locale.ENGLISH);
String s = UUID.randomUUID().toString().toLowerCase(Locale.ROOT);
assertU(adoc("id", "101", "uuid", s));
assertU(commit());
LocalSolrQueryRequest req = lrf.makeRequest("q", "*:*");

View File

@ -52,7 +52,7 @@ public class TestFaceting extends SolrTestCaseJ4 {
}
String t(int tnum) {
return String.format(Locale.US, "%08d", tnum);
return String.format(Locale.ROOT, "%08d", tnum);
}
void createIndex(int nTerms) {

View File

@ -31,7 +31,7 @@ import java.util.Locale;
public class DateFieldTest extends LuceneTestCase {
public static TimeZone UTC = TimeZone.getTimeZone("UTC");
protected DateField f = null;
protected DateMathParser p = new DateMathParser(UTC, Locale.US);
protected DateMathParser p = new DateMathParser(UTC, Locale.ROOT);
@Override
public void setUp() throws Exception {

View File

@ -906,7 +906,7 @@ public class TestRecovery extends SolrTestCaseJ4 {
// WARNING... assumes format of .00000n where n is less than 9
long logNumber = Long.parseLong(fname.substring(fname.lastIndexOf(".") + 1));
String fname2 = String.format(Locale.ENGLISH,
String fname2 = String.format(Locale.ROOT,
UpdateLog.LOG_FILENAME_PATTERN,
UpdateLog.TLOG_NAME,
logNumber + 1);

View File

@ -55,17 +55,17 @@ public class DateMathParserTest extends LuceneTestCase {
public DateMathParserTest() {
super();
fmt = new SimpleDateFormat
("G yyyyy MM ww WW DD dd F E aa HH hh mm ss SSS z Z",Locale.US);
("G yyyyy MM ww WW DD dd F E aa HH hh mm ss SSS z Z",Locale.ROOT);
fmt.setTimeZone(UTC);
parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS",Locale.US);
parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS",Locale.ROOT);
parser.setTimeZone(UTC);
}
/** MACRO: Round: parses s, rounds with u, fmts */
protected String r(String s, String u) throws Exception {
Date d = parser.parse(s);
Calendar c = Calendar.getInstance(UTC, Locale.US);
Calendar c = Calendar.getInstance(UTC, Locale.ROOT);
c.setTime(d);
DateMathParser.round(c, u);
return fmt.format(c.getTime());
@ -74,7 +74,7 @@ public class DateMathParserTest extends LuceneTestCase {
/** MACRO: Add: parses s, adds v u, fmts */
protected String a(String s, int v, String u) throws Exception {
Date d = parser.parse(s);
Calendar c = Calendar.getInstance(UTC, Locale.US);
Calendar c = Calendar.getInstance(UTC, Locale.ROOT);
c.setTime(d);
DateMathParser.add(c, v, u);
return fmt.format(c.getTime());
@ -162,7 +162,7 @@ public class DateMathParserTest extends LuceneTestCase {
public void testParseStatelessness() throws Exception {
DateMathParser p = new DateMathParser(UTC, Locale.US);
DateMathParser p = new DateMathParser(UTC, Locale.ROOT);
p.setNow(parser.parse("2001-07-04T12:08:56.235"));
String e = fmt.format(p.parseMath(""));
@ -179,7 +179,7 @@ public class DateMathParserTest extends LuceneTestCase {
public void testParseMath() throws Exception {
DateMathParser p = new DateMathParser(UTC, Locale.US);
DateMathParser p = new DateMathParser(UTC, Locale.ROOT);
p.setNow(parser.parse("2001-07-04T12:08:56.235"));
// No-Op
@ -272,7 +272,7 @@ public class DateMathParserTest extends LuceneTestCase {
// US, Positive Offset with DST
TimeZone tz = TimeZone.getTimeZone(PLUS_TZS);
DateMathParser p = new DateMathParser(tz, Locale.US);
DateMathParser p = new DateMathParser(tz, Locale.ROOT);
p.setNow(parser.parse("2001-07-04T12:08:56.235"));
@ -294,7 +294,7 @@ public class DateMathParserTest extends LuceneTestCase {
// France, Negative Offset with DST
tz = TimeZone.getTimeZone(NEG_TZS);
p = new DateMathParser(tz, Locale.US);
p = new DateMathParser(tz, Locale.ROOT);
p.setNow(parser.parse("2001-07-04T12:08:56.235"));
assertMath("2001-07-04T12:08:56.000", p, "/SECOND");
@ -311,7 +311,7 @@ public class DateMathParserTest extends LuceneTestCase {
public void testParseMathExceptions() throws Exception {
DateMathParser p = new DateMathParser(UTC, Locale.US);
DateMathParser p = new DateMathParser(UTC, Locale.ROOT);
p.setNow(parser.parse("2001-07-04T12:08:56.235"));
Map<String,Integer> badCommands = new HashMap<String,Integer>();

View File

@ -120,10 +120,10 @@ public class TimeZoneUtilsTest extends LuceneTestCase {
int hour = _TestUtil.nextInt(r, 0, 23);
int min = _TestUtil.nextInt(r, 0, 59);
String hours = String.format(Locale.US,
String hours = String.format(Locale.ROOT,
(r.nextBoolean() ? ONE_DIGIT : TWO_DIGIT),
hour);
String mins = String.format(Locale.US, TWO_DIGIT, min);
String mins = String.format(Locale.ROOT, TWO_DIGIT, min);
String input = "GMT" + (r.nextBoolean()?"+":"-")
+ hours + (r.nextBoolean() ? "" : ((r.nextBoolean()?":":"") + mins));
assertSameRules(input,

View File

@ -178,7 +178,7 @@ public class DocumentObjectBinder {
} else {
String setterName = setter.getName();
if (setterName.startsWith("set") && setterName.length() > 3) {
name = setterName.substring(3, 4).toLowerCase(Locale.ENGLISH) + setterName.substring(4);
name = setterName.substring(3, 4).toLowerCase(Locale.ROOT) + setterName.substring(4);
} else {
name = setter.getName();
}

View File

@ -190,7 +190,7 @@ public class XMLResponseParser extends ResponseParser
{
if( v != null ) {
try {
return KnownType.valueOf( v.toUpperCase(Locale.ENGLISH) );
return KnownType.valueOf( v.toUpperCase(Locale.ROOT) );
}
catch( Exception ex ) {}
}
@ -270,7 +270,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(Locale.ENGLISH) ) ) {
if( !"arr".equals( parser.getLocalName().toLowerCase(Locale.ROOT) ) ) {
throw new RuntimeException( "must be 'arr', not: "+parser.getLocalName() );
}
@ -373,7 +373,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(Locale.ENGLISH) ) ) {
if( !"doc".equals( parser.getLocalName().toLowerCase(Locale.ROOT) ) ) {
throw new RuntimeException( "must be 'lst', not: "+parser.getLocalName() );
}

View File

@ -34,7 +34,7 @@ public interface CollectionParams
{
if( p != null ) {
try {
return CollectionAction.valueOf( p.toUpperCase(Locale.ENGLISH) );
return CollectionAction.valueOf( p.toUpperCase(Locale.ROOT) );
}
catch( Exception ex ) {}
}

View File

@ -154,7 +154,7 @@ public interface CommonParams {
public static EchoParamStyle get( String v ) {
if( v != null ) {
v = v.toUpperCase(Locale.ENGLISH);
v = v.toUpperCase(Locale.ROOT);
if( v.equals( "EXPLICIT" ) ) {
return EXPLICIT;
}

View File

@ -99,7 +99,7 @@ public interface CoreAdminParams
{
if( p != null ) {
try {
return CoreAdminAction.valueOf( p.toUpperCase(Locale.ENGLISH) );
return CoreAdminAction.valueOf( p.toUpperCase(Locale.ROOT) );
}
catch( Exception ex ) {}
}

View File

@ -317,10 +317,10 @@ public interface FacetParams {
public enum FacetRangeInclude {
ALL, LOWER, UPPER, EDGE, OUTER;
@Override
public String toString() { return super.toString().toLowerCase(Locale.ENGLISH); }
public String toString() { return super.toString().toLowerCase(Locale.ROOT); }
public static FacetRangeInclude get(String label) {
try {
return valueOf(label.toUpperCase(Locale.ENGLISH));
return valueOf(label.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new SolrException
(SolrException.ErrorCode.BAD_REQUEST,

View File

@ -59,7 +59,7 @@ public interface MoreLikeThisParams
public static TermStyle get( String p )
{
if( p != null ) {
p = p.toUpperCase(Locale.ENGLISH);
p = p.toUpperCase(Locale.ROOT);
if( p.equals( "DETAILS" ) ) {
return DETAILS;
}

View File

@ -52,7 +52,7 @@ public abstract class ContentStreamBase implements ContentStream
public static String getCharsetFromContentType( String contentType )
{
if( contentType != null ) {
int idx = contentType.toLowerCase(Locale.ENGLISH).indexOf( "charset=" );
int idx = contentType.toLowerCase(Locale.ROOT).indexOf( "charset=" );
if( idx > 0 ) {
return contentType.substring( idx + "charset=".length() ).trim();
}

View File

@ -57,7 +57,7 @@ public class DateUtil {
private static final Date DEFAULT_TWO_DIGIT_YEAR_START;
static {
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.US);
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.ROOT);
calendar.set(2000, Calendar.JANUARY, 1, 0, 0);
DEFAULT_TWO_DIGIT_YEAR_START = calendar.getTime();
}
@ -147,7 +147,7 @@ public class DateUtil {
while (formatIter.hasNext()) {
String format = (String) formatIter.next();
if (dateParser == null) {
dateParser = new SimpleDateFormat(format, Locale.US);
dateParser = new SimpleDateFormat(format, Locale.ROOT);
dateParser.setTimeZone(GMT);
dateParser.set2DigitYearStart(startDate);
} else {
@ -184,7 +184,7 @@ public class DateUtil {
public ThreadLocalDateFormat() {
super();
//2007-04-26T08:05:04Z
SimpleDateFormat tmp = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
SimpleDateFormat tmp = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ROOT);
tmp.setTimeZone(UTC);
proto = tmp;
}
@ -202,7 +202,7 @@ public class DateUtil {
// builder's buffer.
StringBuilder sb = out instanceof StringBuilder ? (StringBuilder)out : new StringBuilder();
if (cal==null) cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.US);
if (cal==null) cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.ROOT);
cal.setTime(date);
int i = cal.get(Calendar.YEAR);

View File

@ -209,7 +209,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(Locale.ENGLISH));
ret.add(str.toLowerCase(Locale.ROOT));
}
return ret;
}