lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1359283 [3/5] - in /lucene/dev/branches/lucene3312: ./ lucene/ lucene/analysis/ lucene/analysis/common/ lucene/analysis/common/src/java/org/apache/lucene/analysis/br/ lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/ l...
Date Mon, 09 Jul 2012 17:05:05 GMT
Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/index/TestDoc.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/index/TestDoc.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/index/TestDoc.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/index/TestDoc.java Mon Jul  9 17:04:57 2012
@@ -17,11 +17,14 @@ package org.apache.lucene.index;
  * limitations under the License.
  */
 import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.io.Writer;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.LinkedList;
@@ -78,14 +81,14 @@ public class TestDoc extends LuceneTestC
     }
 
     private File createOutput(String name, String text) throws IOException {
-        FileWriter fw = null;
+        Writer fw = null;
         PrintWriter pw = null;
 
         try {
             File f = new File(workDir, name);
             if (f.exists()) f.delete();
 
-            fw = new FileWriter(f);
+            fw = new OutputStreamWriter(new FileOutputStream(f), "UTF-8");
             pw = new PrintWriter(fw);
             pw.println(text);
             return f;
@@ -182,9 +185,11 @@ public class TestDoc extends LuceneTestC
    {
       File file = new File(workDir, fileName);
       Document doc = new Document();
-      doc.add(new TextField("contents", new FileReader(file), Field.Store.NO));
+      InputStreamReader is = new InputStreamReader(new FileInputStream(file), "UTF-8");
+      doc.add(new TextField("contents", is, Field.Store.NO));
       writer.addDocument(doc);
       writer.commit();
+      is.close();
       return writer.newestSegment();
    }
 

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/index/TestPayloads.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/index/TestPayloads.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/index/TestPayloads.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/index/TestPayloads.java Mon Jul  9 17:04:57 2012
@@ -43,9 +43,8 @@ public class TestPayloads extends Lucene
     
     // Simple tests to test the Payload class
     public void testPayload() throws Exception {
-        byte[] testData = "This is a test!".getBytes();
-        BytesRef payload = new BytesRef(testData);
-        assertEquals("Wrong payload length.", testData.length, payload.length);
+        BytesRef payload = new BytesRef("This is a test!");
+        assertEquals("Wrong payload length.", "This is a test!".length(), payload.length);
         
         BytesRef clone = payload.clone();
         assertEquals(payload.length, clone.length);
@@ -73,7 +72,7 @@ public class TestPayloads extends Lucene
         // enabled in only some documents
         d.add(newTextField("f3", "This field has payloads in some docs", Field.Store.NO));
         // only add payload data for field f2
-        analyzer.setPayloadData("f2", "somedata".getBytes(), 0, 1);
+        analyzer.setPayloadData("f2", "somedata".getBytes("UTF-8"), 0, 1);
         writer.addDocument(d);
         // flush
         writer.close();
@@ -96,8 +95,8 @@ public class TestPayloads extends Lucene
         d.add(newTextField("f2", "This field has payloads in all docs", Field.Store.NO));
         d.add(newTextField("f3", "This field has payloads in some docs", Field.Store.NO));
         // add payload data for field f2 and f3
-        analyzer.setPayloadData("f2", "somedata".getBytes(), 0, 1);
-        analyzer.setPayloadData("f3", "somedata".getBytes(), 0, 3);
+        analyzer.setPayloadData("f2", "somedata".getBytes("UTF-8"), 0, 1);
+        analyzer.setPayloadData("f3", "somedata".getBytes("UTF-8"), 0, 3);
         writer.addDocument(d);
 
         // force merge

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java Mon Jul  9 17:04:57 2012
@@ -29,6 +29,8 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
 import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
 import java.util.Random;
 
 /** Test that BooleanQuery.setMinimumNumberShouldMatch works.
@@ -378,7 +380,7 @@ public class TestBooleanMinShouldMatch e
 
         System.err.println("------- " + test + " -------");
 
-        DecimalFormat f = new DecimalFormat("0.000000");
+        DecimalFormat f = new DecimalFormat("0.000000", DecimalFormatSymbols.getInstance(Locale.ROOT));
 
         for (int i = 0; i < h.length; i++) {
             StoredDocument d = searcher.doc(h[i].doc);

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestCustomSearcherSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestCustomSearcherSort.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestCustomSearcherSort.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestCustomSearcherSort.java Mon Jul  9 17:04:57 2012
@@ -19,8 +19,10 @@ package org.apache.lucene.search;
 import java.io.IOException;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Random;
+import java.util.TimeZone;
 import java.util.TreeMap;
 
 import org.apache.lucene.document.DateTools;
@@ -230,10 +232,12 @@ public class TestCustomSearcherSort exte
   private class RandomGen {
     RandomGen(Random random) {
       this.random = random;
+      base.set(1980, 1, 1);
     }
     
     private Random random;
-    private Calendar base = new GregorianCalendar(1980, 1, 1);
+    // we use the default Locale/TZ since LuceneTestCase randomizes it
+    private Calendar base = new GregorianCalendar(TimeZone.getDefault(), Locale.getDefault());
     
     // Just to generate some different Lucene Date strings
     private String getLuceneDate() {

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java Mon Jul  9 17:04:57 2012
@@ -36,6 +36,8 @@ import org.apache.lucene.search.similari
 import org.apache.lucene.store.Directory;
 
 import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
 import java.io.IOException;
 
 /**
@@ -486,7 +488,7 @@ public class TestDisjunctionMaxQuery ext
     
     System.err.println("------- " + test + " -------");
     
-    DecimalFormat f = new DecimalFormat("0.000000000");
+    DecimalFormat f = new DecimalFormat("0.000000000", DecimalFormatSymbols.getInstance(Locale.ROOT));
     
     for (int i = 0; i < h.length; i++) {
       StoredDocument d = searcher.doc(h[i].doc);

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java Mon Jul  9 17:04:57 2012
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -117,10 +118,10 @@ public class TestFieldCache extends Luce
     try {
       FieldCache cache = FieldCache.DEFAULT;
       ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
-      cache.setInfoStream(new PrintStream(bos));
+      cache.setInfoStream(new PrintStream(bos, false, "UTF-8"));
       cache.getDoubles(reader, "theDouble", false);
       cache.getFloats(reader, "theDouble", false);
-      assertTrue(bos.toString().indexOf("WARNING") != -1);
+      assertTrue(bos.toString("UTF-8").indexOf("WARNING") != -1);
     } finally {
       FieldCache.DEFAULT.purgeAllCaches();
     }
@@ -261,7 +262,7 @@ public class TestFieldCache extends Luce
         if (chunk == 0) {
           for (int ord = 0; ord < values.size(); ord++) {
             BytesRef term = values.get(ord);
-            assertNull(String.format("Document[%d] misses field must be null. Has value %s for ord %d", i, term, ord), term);
+            assertNull(String.format(Locale.ROOT, "Document[%d] misses field must be null. Has value %s for ord %d", i, term, ord), term);
           }
           break;
         }
@@ -275,7 +276,7 @@ public class TestFieldCache extends Luce
               reuse = termOrds.lookup(i, reuse);
               reuse.read(buffer);
           }
-          assertTrue(String.format("Expected value %s for doc %d and ord %d, but was %s", expected, i, idx, actual), expected.equals(actual));
+          assertTrue(String.format(Locale.ROOT, "Expected value %s for doc %d and ord %d, but was %s", expected, i, idx, actual), expected.equals(actual));
         }
 
         if (chunk <= buffer.length) {

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java Mon Jul  9 17:04:57 2012
@@ -44,7 +44,7 @@ public class TestMultiValuedNumericRange
         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++) {

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom.java Mon Jul  9 17:04:57 2012
@@ -58,7 +58,7 @@ public class TestRegexpRandom extends Lu
     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);

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java Mon Jul  9 17:04:57 2012
@@ -54,7 +54,7 @@ public class TestWildcardRandom extends 
     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);

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java Mon Jul  9 17:04:57 2012
@@ -81,7 +81,7 @@ public class TestBasics extends LuceneTe
     @Override
     public boolean incrementToken() throws IOException {
       if (input.incrementToken()) {
-        payloadAttr.setPayload(new BytesRef(("pos: " + pos).getBytes()));
+        payloadAttr.setPayload(new BytesRef(("pos: " + pos).getBytes("UTF-8")));
         pos++;
         return true;
       } else {
@@ -411,7 +411,7 @@ public class TestBasics extends LuceneTe
   @Test
   public void testSpanPayloadCheck() throws Exception {
     SpanTermQuery term1 = new SpanTermQuery(new Term("field", "five"));
-    BytesRef pay = new BytesRef(("pos: " + 5).getBytes());
+    BytesRef pay = new BytesRef(("pos: " + 5).getBytes("UTF-8"));
     SpanQuery query = new SpanPayloadCheckQuery(term1, Collections.singletonList(pay.bytes));
     checkHits(query, new int[]
       {1125, 1135, 1145, 1155, 1165, 1175, 1185, 1195, 1225, 1235, 1245, 1255, 1265, 1275, 1285, 1295, 1325, 1335, 1345, 1355, 1365, 1375, 1385, 1395, 1425, 1435, 1445, 1455, 1465, 1475, 1485, 1495, 1525, 1535, 1545, 1555, 1565, 1575, 1585, 1595, 1625, 1635, 1645, 1655, 1665, 1675, 1685, 1695, 1725, 1735, 1745, 1755, 1765, 1775, 1785, 1795, 1825, 1835, 1845, 1855, 1865, 1875, 1885, 1895, 1925, 1935, 1945, 1955, 1965, 1975, 1985, 1995});
@@ -426,8 +426,8 @@ public class TestBasics extends LuceneTe
     clauses[0] = term1;
     clauses[1] = term2;
     snq = new SpanNearQuery(clauses, 0, true);
-    pay = new BytesRef(("pos: " + 0).getBytes());
-    pay2 = new BytesRef(("pos: " + 1).getBytes());
+    pay = new BytesRef(("pos: " + 0).getBytes("UTF-8"));
+    pay2 = new BytesRef(("pos: " + 1).getBytes("UTF-8"));
     list = new ArrayList<byte[]>();
     list.add(pay.bytes);
     list.add(pay2.bytes);
@@ -439,9 +439,9 @@ public class TestBasics extends LuceneTe
     clauses[1] = term2;
     clauses[2] = new SpanTermQuery(new Term("field", "five"));
     snq = new SpanNearQuery(clauses, 0, true);
-    pay = new BytesRef(("pos: " + 0).getBytes());
-    pay2 = new BytesRef(("pos: " + 1).getBytes());
-    BytesRef pay3 = new BytesRef(("pos: " + 2).getBytes());
+    pay = new BytesRef(("pos: " + 0).getBytes("UTF-8"));
+    pay2 = new BytesRef(("pos: " + 1).getBytes("UTF-8"));
+    BytesRef pay3 = new BytesRef(("pos: " + 2).getBytes("UTF-8"));
     list = new ArrayList<byte[]>();
     list.add(pay.bytes);
     list.add(pay2.bytes);
@@ -470,10 +470,10 @@ public class TestBasics extends LuceneTe
     checkHits(query, new int[]{1103, 1203,1303,1403,1503,1603,1703,1803,1903});
 
     Collection<byte[]> payloads = new ArrayList<byte[]>();
-    BytesRef pay = new BytesRef(("pos: " + 0).getBytes());
-    BytesRef pay2 = new BytesRef(("pos: " + 1).getBytes());
-    BytesRef pay3 = new BytesRef(("pos: " + 3).getBytes());
-    BytesRef pay4 = new BytesRef(("pos: " + 4).getBytes());
+    BytesRef pay = new BytesRef(("pos: " + 0).getBytes("UTF-8"));
+    BytesRef pay2 = new BytesRef(("pos: " + 1).getBytes("UTF-8"));
+    BytesRef pay3 = new BytesRef(("pos: " + 3).getBytes("UTF-8"));
+    BytesRef pay4 = new BytesRef(("pos: " + 4).getBytes("UTF-8"));
     payloads.add(pay.bytes);
     payloads.add(pay2.bytes);
     payloads.add(pay3.bytes);

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java Mon Jul  9 17:04:57 2012
@@ -276,7 +276,7 @@ public class TestPayloadSpans extends Lu
         Collection<byte[]> payloads = spans.getPayload();
 
         for (final byte [] payload : payloads) {
-          payloadSet.add(new String(payload));
+          payloadSet.add(new String(payload, "UTF-8"));
         }
       }
     }
@@ -311,7 +311,7 @@ public class TestPayloadSpans extends Lu
       while (spans.next()) {
         Collection<byte[]> payloads = spans.getPayload();
         for (final byte[] payload : payloads) {
-          payloadSet.add(new String(payload));
+          payloadSet.add(new String(payload, "UTF-8"));
         }
       }
     }
@@ -347,7 +347,7 @@ public class TestPayloadSpans extends Lu
         Collection<byte[]> payloads = spans.getPayload();
 
         for (final byte [] payload : payloads) {
-          payloadSet.add(new String(payload));
+          payloadSet.add(new String(payload, "UTF-8"));
         }
       }
     }
@@ -383,7 +383,7 @@ public class TestPayloadSpans extends Lu
       System.out.println("Num payloads:" + payloads.size());
     for (final byte [] bytes : payloads) {
       if(VERBOSE)
-        System.out.println(new String(bytes));
+        System.out.println(new String(bytes, "UTF-8"));
     }
     reader.close();
     directory.close();
@@ -456,7 +456,7 @@ public class TestPayloadSpans extends Lu
         for (final byte [] bytes : payload) {
           if(VERBOSE)
             System.out.println("doc:" + spans.doc() + " s:" + spans.start() + " e:" + spans.end() + " "
-              + new String(bytes));
+              + new String(bytes, "UTF-8"));
         }
 
         assertEquals(numPayloads[cnt],payload.size());
@@ -505,9 +505,9 @@ public class TestPayloadSpans extends Lu
 
         if (!nopayload.contains(token)) {
           if (entities.contains(token)) {
-            payloadAtt.setPayload(new BytesRef((token + ":Entity:"+ pos ).getBytes()));
+            payloadAtt.setPayload(new BytesRef(token + ":Entity:"+ pos ));
           } else {
-            payloadAtt.setPayload(new BytesRef((token + ":Noise:" + pos ).getBytes()));
+            payloadAtt.setPayload(new BytesRef(token + ":Noise:" + pos ));
           }
         }
         pos += posIncrAtt.getPositionIncrement();

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.java Mon Jul  9 17:04:57 2012
@@ -59,7 +59,7 @@ public class StressRamUsageEstimator ext
         // 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 ext
           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)));

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java Mon Jul  9 17:04:57 2012
@@ -1298,7 +1298,7 @@ public class TestFSTs extends LuceneTest
           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) {
@@ -1637,7 +1637,7 @@ public class TestFSTs extends LuceneTest
         String idString;
         if (cycle == 0) {
           // PKs are assigned sequentially
-          idString = String.format("%07d", id);
+          idString = String.format(Locale.ROOT, "%07d", id);
         } else {
           while(true) {
             final String s = Long.toString(random().nextLong());
@@ -1668,7 +1668,7 @@ public class TestFSTs extends LuceneTest
       for(int idx=0;idx<NUM_IDS/10;idx++) {
         String idString;
         if (cycle == 0) {
-          idString = String.format("%07d", (NUM_IDS + idx));
+          idString = String.format(Locale.ROOT, "%07d", (NUM_IDS + idx));
         } else {
           while(true) {
             idString = Long.toString(random().nextLong());
@@ -1710,8 +1710,8 @@ public class TestFSTs extends LuceneTest
           exists = false;
           final int idv = random().nextInt(NUM_IDS-1);
           if (cycle == 0) {
-            id = String.format("%07da", idv);
-            nextID = String.format("%07d", idv+1);
+            id = String.format(Locale.ROOT, "%07da", idv);
+            nextID = String.format(Locale.ROOT, "%07d", idv+1);
           } else {
             id = sortedAllIDsList.get(idv) + "a";
             nextID = sortedAllIDsList.get(idv+1);

Modified: lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java (original)
+++ lucene/dev/branches/lucene3312/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java Mon Jul  9 17:04:57 2012
@@ -20,6 +20,7 @@ package org.apache.lucene.util.packed;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Random;
 
 import org.apache.lucene.codecs.CodecUtil;
@@ -267,7 +268,7 @@ public class TestPackedInts extends Luce
         fill(packedInt, PackedInts.maxValue(bitsPerValue), randomSeed);
       } catch (Exception e) {
         e.printStackTrace(System.err);
-        fail(String.format(
+        fail(String.format(Locale.ROOT,
                 "Exception while filling %s: valueCount=%d, bitsPerValue=%s",
                 packedInt.getClass().getSimpleName(),
                 valueCount, bitsPerValue));
@@ -311,7 +312,7 @@ public class TestPackedInts extends Luce
     for (int i = 0 ; i < packedInt.size() ; i++) {
       long value = _TestUtil.nextLong(rnd2, 0, maxValue);
       packedInt.set(i, value);
-      assertEquals(String.format(
+      assertEquals(String.format(Locale.ROOT,
               "The set/get of the value at index %d should match for %s",
               i, packedInt.getClass().getSimpleName()),
               value, packedInt.get(i));
@@ -336,7 +337,7 @@ public class TestPackedInts extends Luce
     }
     for (int i = 0 ; i < valueCount ; i++) {
       for (int j = 1 ; j < packedInts.size() ; j++) {
-        assertEquals(String.format(
+        assertEquals(String.format(Locale.ROOT,
                 "%s. The value at index %d should be the same for %s and %s",
                 message, i, base.getClass().getSimpleName(),
                 packedInts.get(j).getClass().getSimpleName()),

Modified: lucene/dev/branches/lucene3312/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java (original)
+++ lucene/dev/branches/lucene3312/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java Mon Jul  9 17:04:57 2012
@@ -49,6 +49,7 @@ import org.apache.lucene.search.Query;
 import org.apache.lucene.search.ScoreDoc;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.Version;
 
 /**
@@ -132,7 +133,7 @@ public class FormBasedXmlQueryDemo exten
     IndexWriterConfig iwConfig = new IndexWriterConfig(Version.LUCENE_40, analyzer);
     IndexWriter writer = new IndexWriter(rd, iwConfig);
     InputStream dataIn = getServletContext().getResourceAsStream("/WEB-INF/data.tsv");
-    BufferedReader br = new BufferedReader(new InputStreamReader(dataIn));
+    BufferedReader br = new BufferedReader(new InputStreamReader(dataIn, IOUtils.CHARSET_UTF_8));
     String line = br.readLine();
     final FieldType textNoNorms = new FieldType(TextField.TYPE_STORED);
     textNoNorms.setOmitNorms(true);

Modified: lucene/dev/branches/lucene3312/lucene/demo/src/test/org/apache/lucene/demo/TestDemo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/demo/src/test/org/apache/lucene/demo/TestDemo.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/demo/src/test/org/apache/lucene/demo/TestDemo.java (original)
+++ lucene/dev/branches/lucene3312/lucene/demo/src/test/org/apache/lucene/demo/TestDemo.java Mon Jul  9 17:04:57 2012
@@ -20,6 +20,7 @@ package org.apache.lucene.demo;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.PrintStream;
+import java.nio.charset.Charset;
 
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util._TestUtil;
@@ -30,11 +31,11 @@ public class TestDemo extends LuceneTest
     PrintStream outSave = System.out;
     try {
       ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-      PrintStream fakeSystemOut = new PrintStream(bytes);
+      PrintStream fakeSystemOut = new PrintStream(bytes, false, Charset.defaultCharset().name());
       System.setOut(fakeSystemOut);
       SearchFiles.main(new String[] {"-query", query, "-index", indexPath.getPath()});
       fakeSystemOut.flush();
-      String output = bytes.toString(); // intentionally use default encoding
+      String output = bytes.toString(Charset.defaultCharset().name()); // intentionally use default encoding
       assertTrue("output=" + output, output.contains(expectedHitCount + " total matching documents"));
     } finally {
       System.setOut(outSave);

Modified: lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCharBlockArray.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCharBlockArray.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCharBlockArray.java (original)
+++ lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCharBlockArray.java Mon Jul  9 17:04:57 2012
@@ -5,9 +5,13 @@ import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.nio.ByteBuffer;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CodingErrorAction;
 
 import org.junit.Test;
 
+import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.facet.taxonomy.writercache.cl2o.CharBlockArray;
 
@@ -41,8 +45,12 @@ public class TestCharBlockArray extends 
     for (int i = 0; i < n; i++) {
       random().nextBytes(buffer);
       int size = 1 + random().nextInt(50);
-
-      String s = new String(buffer, 0, size);
+      // This test is turning random bytes into a string,
+      // this is asking for trouble.
+      CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
+          .onUnmappableCharacter(CodingErrorAction.REPLACE)
+          .onMalformedInput(CodingErrorAction.REPLACE);
+      String s = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
       array.append(s);
       builder.append(s);
     }
@@ -50,8 +58,12 @@ public class TestCharBlockArray extends 
     for (int i = 0; i < n; i++) {
       random().nextBytes(buffer);
       int size = 1 + random().nextInt(50);
-
-      String s = new String(buffer, 0, size);
+      // This test is turning random bytes into a string,
+      // this is asking for trouble.
+      CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
+          .onUnmappableCharacter(CodingErrorAction.REPLACE)
+          .onMalformedInput(CodingErrorAction.REPLACE);
+      String s = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
       array.append((CharSequence)s);
       builder.append(s);
     }
@@ -59,8 +71,12 @@ public class TestCharBlockArray extends 
     for (int i = 0; i < n; i++) {
       random().nextBytes(buffer);
       int size = 1 + random().nextInt(50);
-
-      String s = new String(buffer, 0, size);
+      // This test is turning random bytes into a string,
+      // this is asking for trouble.
+      CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
+          .onUnmappableCharacter(CodingErrorAction.REPLACE)
+          .onMalformedInput(CodingErrorAction.REPLACE);
+      String s = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
       for (int j = 0; j < s.length(); j++) {
         array.append(s.charAt(j));
       }

Modified: lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java (original)
+++ lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/cl2o/TestCompactLabelToOrdinal.java Mon Jul  9 17:04:57 2012
@@ -1,11 +1,15 @@
 package org.apache.lucene.facet.taxonomy.writercache.cl2o;
 
 import java.io.File;
+import java.nio.ByteBuffer;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CodingErrorAction;
 import java.util.HashMap;
 import java.util.Map;
 
 import org.junit.Test;
 
+import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.facet.taxonomy.CategoryPath;
 import org.apache.lucene.facet.taxonomy.writercache.cl2o.CompactLabelToOrdinal;
@@ -46,7 +50,12 @@ public class TestCompactLabelToOrdinal e
       random().nextBytes(buffer);
       int size = 1 + random().nextInt(50);
 
-      uniqueValues[i] = new String(buffer, 0, size);
+      // This test is turning random bytes into a string,
+      // this is asking for trouble.
+      CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
+          .onUnmappableCharacter(CodingErrorAction.REPLACE)
+          .onMalformedInput(CodingErrorAction.REPLACE);
+      uniqueValues[i] = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
       if (uniqueValues[i].indexOf(CompactLabelToOrdinal.TerminatorChar) == -1) {
         i++;
       }

Modified: lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/util/encoding/EncodingSpeed.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/util/encoding/EncodingSpeed.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/util/encoding/EncodingSpeed.java (original)
+++ lucene/dev/branches/lucene3312/lucene/facet/src/test/org/apache/lucene/util/encoding/EncodingSpeed.java Mon Jul  9 17:04:57 2012
@@ -5,6 +5,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.text.NumberFormat;
 import java.util.Arrays;
+import java.util.Locale;
 
 import org.apache.lucene.util.encoding.DGapIntEncoder;
 import org.apache.lucene.util.encoding.EightFlagsIntEncoder;
@@ -67,11 +68,11 @@ public class EncodingSpeed {
             + ") " + loopFactor + " times.");
 
     System.out.println();
-    String header = String.format(headerFormat, "Encoder", "Bits/Int",
+    String header = String.format(Locale.ROOT, headerFormat, "Encoder", "Bits/Int",
         "Encode Time", "Encode Time", "Decode Time", "Decode Time");
 
     System.out.println(header);
-    String header2 = String.format(headerFormat, "", "", "[milliseconds]",
+    String header2 = String.format(Locale.ROOT, headerFormat, "", "", "[milliseconds]",
         "[microsecond / int]", "[milliseconds]", "[microsecond / int]");
 
     System.out.println(header2);
@@ -148,7 +149,7 @@ public class EncodingSpeed {
     endTime = System.currentTimeMillis();
     long decodeTime = endTime - startTime;
 
-    System.out.println(String.format(resultsFormat, encoder, nf.format(baos
+    System.out.println(String.format(Locale.ROOT, resultsFormat, encoder, nf.format(baos
         .size()
         * 8.0 / data.length), encodeTime, nf.format(encodeTime
         * 1000000.0 / (loopFactor * data.length)), decodeTime, nf
@@ -156,7 +157,7 @@ public class EncodingSpeed {
   }
 
   static {
-    nf = NumberFormat.getInstance();
+    nf = NumberFormat.getInstance(Locale.ROOT);
     nf.setMaximumFractionDigits(4);
     nf.setMinimumFractionDigits(4);
 

Modified: lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupHeadsCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupHeadsCollector.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupHeadsCollector.java (original)
+++ lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupHeadsCollector.java Mon Jul  9 17:04:57 2012
@@ -30,6 +30,7 @@ import org.apache.lucene.util.BytesRef;
 import java.io.IOException;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 /**
@@ -88,7 +89,7 @@ public abstract class DVAllGroupHeadsCol
       case BYTES_FIXED_SORTED:
         return (DVAllGroupHeadsCollector) new GeneralAllGroupHeadsCollector.SortedBR(groupField, type, sortWithinGroup, diskResident);
       default:
-        throw new IllegalArgumentException(String.format("ValueType %s not supported", type));
+        throw new IllegalArgumentException(String.format(Locale.ROOT, "ValueType %s not supported", type));
     }
   }
 

Modified: lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupsCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupsCollector.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupsCollector.java (original)
+++ lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupsCollector.java Mon Jul  9 17:04:57 2012
@@ -77,7 +77,7 @@ public abstract class DVAllGroupsCollect
         // Type erasure b/c otherwise we have inconvertible types...
         return (DVAllGroupsCollector) new SortedBR(groupField, type, diskResident, initialSize);
       default:
-        throw new IllegalArgumentException(String.format("ValueType %s not supported", type));
+        throw new IllegalArgumentException(String.format(Locale.ROOT, "ValueType %s not supported", type));
     }
   }
 

Modified: lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVDistinctValuesCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVDistinctValuesCollector.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVDistinctValuesCollector.java (original)
+++ lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVDistinctValuesCollector.java Mon Jul  9 17:04:57 2012
@@ -83,7 +83,7 @@ public abstract class DVDistinctValuesCo
         // Type erasure b/c otherwise we have inconvertible types...
         return (DVDistinctValuesCollector) new Sorted.BR(groupField, countField, (Collection) groups, diskResident, type);
       default:
-        throw new IllegalArgumentException(String.format("ValueType %s not supported", type));
+        throw new IllegalArgumentException(String.format(Locale.ROOT, "ValueType %s not supported", type));
     }
   }
 

Modified: lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVFirstPassGroupingCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVFirstPassGroupingCollector.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVFirstPassGroupingCollector.java (original)
+++ lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVFirstPassGroupingCollector.java Mon Jul  9 17:04:57 2012
@@ -25,6 +25,7 @@ import org.apache.lucene.search.grouping
 import org.apache.lucene.util.BytesRef;
 
 import java.io.IOException;
+import java.util.Locale;
 
 /**
  * IDV based Implementations of {@link AbstractFirstPassGroupingCollector}.
@@ -74,7 +75,7 @@ public abstract class DVFirstPassGroupin
         // Type erasure b/c otherwise we have inconvertible types...
         return (DVFirstPassGroupingCollector) new SortedBR(groupSort, topNGroups, groupField, diskResident, type);
       default:
-        throw new IllegalArgumentException(String.format("ValueType %s not supported", type));
+        throw new IllegalArgumentException(String.format(Locale.ROOT, "ValueType %s not supported", type));
     }
   }
 

Modified: lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVGroupFacetCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVGroupFacetCollector.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVGroupFacetCollector.java (original)
+++ lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVGroupFacetCollector.java Mon Jul  9 17:04:57 2012
@@ -29,6 +29,7 @@ import org.apache.lucene.util.UnicodeUti
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 
 /**
  * An implementation of {@link AbstractGroupFacetCollector} that computes grouped facets based on docvalues.
@@ -84,12 +85,12 @@ public abstract class DVGroupFacetCollec
       case BYTES_FIXED_DEREF:
       case BYTES_VAR_STRAIGHT:
       case BYTES_VAR_DEREF:
-        throw new IllegalArgumentException(String.format("Group valueType %s not supported", groupDvType));
+        throw new IllegalArgumentException(String.format(Locale.ROOT, "Group valueType %s not supported", groupDvType));
       case BYTES_VAR_SORTED:
       case BYTES_FIXED_SORTED:
         return GroupSortedBR.createGroupSortedFacetCollector(groupField, groupDvType, groupDiskResident, facetField, facetDvType, facetDiskResident, facetPrefix, initialSize);
       default:
-        throw new IllegalArgumentException(String.format("Group valueType %s not supported", groupDvType));
+        throw new IllegalArgumentException(String.format(Locale.ROOT, "Group valueType %s not supported", groupDvType));
     }
   }
 
@@ -133,12 +134,12 @@ public abstract class DVGroupFacetCollec
         case BYTES_FIXED_DEREF:
         case BYTES_VAR_STRAIGHT:
         case BYTES_VAR_DEREF:
-          throw new IllegalArgumentException(String.format("Facet valueType %s not supported", facetDvType));
+          throw new IllegalArgumentException(String.format(Locale.ROOT, "Facet valueType %s not supported", facetDvType));
         case BYTES_VAR_SORTED:
         case BYTES_FIXED_SORTED:
           return new FacetSortedBR(groupField, groupDvType, groupDiskResident, facetField, facetDvType, facetDiskResident, facetPrefix, initialSize);
         default:
-          throw new IllegalArgumentException(String.format("Facet valueType %s not supported", facetDvType));
+          throw new IllegalArgumentException(String.format(Locale.ROOT, "Facet valueType %s not supported", facetDvType));
       }
     }
 

Modified: lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVSecondPassGroupingCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVSecondPassGroupingCollector.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVSecondPassGroupingCollector.java (original)
+++ lucene/dev/branches/lucene3312/lucene/grouping/src/java/org/apache/lucene/search/grouping/dv/DVSecondPassGroupingCollector.java Mon Jul  9 17:04:57 2012
@@ -28,6 +28,7 @@ import org.apache.lucene.util.SentinelIn
 
 import java.io.IOException;
 import java.util.Collection;
+import java.util.Locale;
 
 /**
  * IDV based implementation of {@link AbstractSecondPassGroupingCollector}.
@@ -87,7 +88,7 @@ public abstract class DVSecondPassGroupi
         // Type erasure b/c otherwise we have inconvertible types...
         return (DVSecondPassGroupingCollector) new SortedBR(groupField, type, diskResident, (Collection) searchGroups, groupSort, withinGroupSort, maxDocsPerGroup, getScores, getMaxScores, fillSortFields);
       default:
-        throw new IllegalArgumentException(String.format("ValueType %s not supported", type));
+        throw new IllegalArgumentException(String.format(Locale.ROOT, "ValueType %s not supported", type));
     }
   }
 

Modified: lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java (original)
+++ lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java Mon Jul  9 17:04:57 2012
@@ -159,7 +159,7 @@ public class AllGroupHeadsCollectorTest 
     int numberOfRuns = _TestUtil.nextInt(random(), 3, 6);
     for (int iter = 0; iter < numberOfRuns; iter++) {
       if (VERBOSE) {
-        System.out.println(String.format("TEST: iter=%d total=%d", iter, numberOfRuns));
+        System.out.println(String.format(Locale.ROOT, "TEST: iter=%d total=%d", iter, numberOfRuns));
       }
 
       final int numDocs = _TestUtil.nextInt(random(), 100, 1000) * RANDOM_MULTIPLIER;
@@ -257,7 +257,7 @@ public class AllGroupHeadsCollectorTest 
             groupValue,
             groups.get(random().nextInt(groups.size())),
             groups.get(random().nextInt(groups.size())),
-            new BytesRef(String.format("%05d", i)),
+            new BytesRef(String.format(Locale.ROOT, "%05d", i)),
             contentStrings[random().nextInt(contentStrings.length)]
         );
 
@@ -349,7 +349,7 @@ public class AllGroupHeadsCollectorTest 
               GroupDoc expectedGroupDoc = groupDocs[expectedDocId];
               String expectedGroup = expectedGroupDoc.group == null ? null : expectedGroupDoc.group.utf8ToString();
               System.out.println(
-                  String.format(
+                  String.format(Locale.ROOT,
                       "Group:%10s score%5f Sort1:%10s Sort2:%10s Sort3:%10s doc:%5d",
                       expectedGroup, expectedGroupDoc.score, expectedGroupDoc.sort1.utf8ToString(),
                       expectedGroupDoc.sort2.utf8ToString(), expectedGroupDoc.sort3.utf8ToString(), expectedDocId
@@ -361,7 +361,7 @@ public class AllGroupHeadsCollectorTest 
               GroupDoc actualGroupDoc = groupDocs[actualDocId];
               String actualGroup = actualGroupDoc.group == null ? null : actualGroupDoc.group.utf8ToString();
               System.out.println(
-                  String.format(
+                  String.format(Locale.ROOT,
                       "Group:%10s score%5f Sort1:%10s Sort2:%10s Sort3:%10s doc:%5d",
                       actualGroup, actualGroupDoc.score, actualGroupDoc.sort1.utf8ToString(),
                       actualGroupDoc.sort2.utf8ToString(), actualGroupDoc.sort3.utf8ToString(), actualDocId

Modified: lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/DistinctValuesCollectorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/DistinctValuesCollectorTest.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/DistinctValuesCollectorTest.java (original)
+++ lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/DistinctValuesCollectorTest.java Mon Jul  9 17:04:57 2012
@@ -450,7 +450,7 @@ public class DistinctValuesCollectorTest
       countsVals.add(countValue);
 
       Document doc = new Document();
-      doc.add(new StringField("id", String.format("%09d", i), Field.Store.NO));
+      doc.add(new StringField("id", String.format(Locale.ROOT, "%09d", i), Field.Store.NO));
       if (groupValue != null) {
         addField(doc, groupField, groupValue, dvType);
       }

Modified: lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/GroupFacetCollectorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/GroupFacetCollectorTest.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/GroupFacetCollectorTest.java (original)
+++ lucene/dev/branches/lucene3312/lucene/grouping/src/test/org/apache/lucene/search/grouping/GroupFacetCollectorTest.java Mon Jul  9 17:04:57 2012
@@ -284,7 +284,7 @@ public class GroupFacetCollectorTest ext
           int counter = 1;
           for (TermGroupFacetCollector.FacetEntry expectedFacetEntry : expectedFacetEntries) {
             System.out.println(
-                String.format(
+                String.format(Locale.ROOT,
                     "%d. Expected facet value %s with count %d",
                     counter++, expectedFacetEntry.getValue().utf8ToString(), expectedFacetEntry.getCount()
                 )
@@ -297,7 +297,7 @@ public class GroupFacetCollectorTest ext
           counter = 1;
           for (TermGroupFacetCollector.FacetEntry actualFacetEntry : actualFacetEntries) {
             System.out.println(
-                String.format(
+                String.format(Locale.ROOT,
                     "%d. Actual facet value %s with count %d",
                     counter++, actualFacetEntry.getValue().utf8ToString(), actualFacetEntry.getCount()
                 )

Modified: lucene/dev/branches/lucene3312/lucene/highlighter/src/test/org/apache/lucene/search/vectorhighlight/BreakIteratorBoundaryScannerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/highlighter/src/test/org/apache/lucene/search/vectorhighlight/BreakIteratorBoundaryScannerTest.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/highlighter/src/test/org/apache/lucene/search/vectorhighlight/BreakIteratorBoundaryScannerTest.java (original)
+++ lucene/dev/branches/lucene3312/lucene/highlighter/src/test/org/apache/lucene/search/vectorhighlight/BreakIteratorBoundaryScannerTest.java Mon Jul  9 17:04:57 2012
@@ -30,7 +30,7 @@ public class BreakIteratorBoundaryScanne
 
   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 BreakIteratorBoundaryScanne
 
   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");
@@ -57,7 +57,8 @@ public class BreakIteratorBoundaryScanne
 
   public void testSentenceBoundary() throws Exception {
     StringBuilder text = new StringBuilder(TEXT);
-    BreakIterator bi = BreakIterator.getSentenceInstance();
+    // we test this with default locale, its randomized by LuceneTestCase
+    BreakIterator bi = BreakIterator.getSentenceInstance(Locale.getDefault());
     BoundaryScanner scanner = new BreakIteratorBoundaryScanner(bi);
     
     int start = TEXT.indexOf("any application");
@@ -70,7 +71,8 @@ public class BreakIteratorBoundaryScanne
 
   public void testLineBoundary() throws Exception {
     StringBuilder text = new StringBuilder(TEXT);
-    BreakIterator bi = BreakIterator.getLineInstance();
+    // we test this with default locale, its randomized by LuceneTestCase
+    BreakIterator bi = BreakIterator.getLineInstance(Locale.getDefault());
     BoundaryScanner scanner = new BreakIteratorBoundaryScanner(bi);
     
     int start = TEXT.indexOf("any application");

Modified: lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/JoinUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/JoinUtil.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/JoinUtil.java (original)
+++ lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/JoinUtil.java Mon Jul  9 17:04:57 2012
@@ -21,6 +21,7 @@ import org.apache.lucene.search.IndexSea
 import org.apache.lucene.search.Query;
 
 import java.io.IOException;
+import java.util.Locale;
 
 /**
  * Utility for query time joining using TermsQuery and TermsCollector.
@@ -85,7 +86,7 @@ public final class JoinUtil {
             fromQuery
         );
       default:
-        throw new IllegalArgumentException(String.format("Score mode %s isn't supported.", scoreMode));
+        throw new IllegalArgumentException(String.format(Locale.ROOT, "Score mode %s isn't supported.", scoreMode));
     }
   }
 

Modified: lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java (original)
+++ lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java Mon Jul  9 17:04:57 2012
@@ -36,6 +36,7 @@ import org.apache.lucene.util.BytesRefHa
 import org.apache.lucene.util.FixedBitSet;
 
 import java.io.IOException;
+import java.util.Locale;
 import java.util.Set;
 
 class TermsIncludingScoreQuery extends Query {
@@ -69,7 +70,7 @@ class TermsIncludingScoreQuery extends Q
   }
 
   public String toString(String string) {
-    return String.format("TermsIncludingScoreQuery{field=%s;originalQuery=%s}", field, unwrittenOriginalQuery);
+    return String.format(Locale.ROOT, "TermsIncludingScoreQuery{field=%s;originalQuery=%s}", field, unwrittenOriginalQuery);
   }
 
   @Override

Modified: lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java (original)
+++ lucene/dev/branches/lucene3312/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java Mon Jul  9 17:04:57 2012
@@ -20,6 +20,7 @@ package org.apache.lucene.search.join;
 import java.io.IOException;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Locale;
 import java.util.Set;
 
 import org.apache.lucene.index.AtomicReaderContext;
@@ -395,7 +396,7 @@ public class ToParentBlockJoinQuery exte
       int start = docBase + prevParentDoc + 1; // +1 b/c prevParentDoc is previous parent doc
       int end = docBase + parentDoc - 1; // -1 b/c parentDoc is parent doc
       return new ComplexExplanation(
-          true, score(), String.format("Score based on child doc range from %d to %d", start, end)
+          true, score(), String.format(Locale.ROOT, "Score based on child doc range from %d to %d", start, end)
       );
     }
 

Modified: lucene/dev/branches/lucene3312/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java (original)
+++ lucene/dev/branches/lucene3312/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java Mon Jul  9 17:04:57 2012
@@ -32,6 +32,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.Locale;
 
 public class TestBlockJoin extends LuceneTestCase {
 
@@ -638,7 +639,7 @@ public class TestBlockJoin extends Lucen
           int childId = Integer.parseInt(document.get("childID"));
           assertTrue(explanation.isMatch());
           assertEquals(hit.score, explanation.getValue(), 0.0f);
-          assertEquals(String.format("Score based on child doc range from %d to %d", hit.doc - 1 - childId, hit.doc - 1), explanation.getDescription());
+          assertEquals(String.format(Locale.ROOT, "Score based on child doc range from %d to %d", hit.doc - 1 - childId, hit.doc - 1), explanation.getDescription());
         }
       }
 

Modified: lucene/dev/branches/lucene3312/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java (original)
+++ lucene/dev/branches/lucene3312/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java Mon Jul  9 17:04:57 2012
@@ -319,12 +319,12 @@ public class TestJoinUtil extends Lucene
           System.out.println("expected cardinality:" + expectedResult.cardinality());
           DocIdSetIterator iterator = expectedResult.iterator();
           for (int doc = iterator.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iterator.nextDoc()) {
-            System.out.println(String.format("Expected doc[%d] with id value %s", doc, indexSearcher.doc(doc).get("id")));
+            System.out.println(String.format(Locale.ROOT, "Expected doc[%d] with id value %s", doc, indexSearcher.doc(doc).get("id")));
           }
           System.out.println("actual cardinality:" + actualResult.cardinality());
           iterator = actualResult.iterator();
           for (int doc = iterator.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iterator.nextDoc()) {
-            System.out.println(String.format("Actual doc[%d] with id value %s", doc, indexSearcher.doc(doc).get("id")));
+            System.out.println(String.format(Locale.ROOT, "Actual doc[%d] with id value %s", doc, indexSearcher.doc(doc).get("id")));
           }
         }
         assertEquals(expectedResult, actualResult);

Modified: lucene/dev/branches/lucene3312/lucene/misc/src/java/org/apache/lucene/index/IndexSplitter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/misc/src/java/org/apache/lucene/index/IndexSplitter.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/misc/src/java/org/apache/lucene/index/IndexSplitter.java (original)
+++ lucene/dev/branches/lucene3312/lucene/misc/src/java/org/apache/lucene/index/IndexSplitter.java Mon Jul  9 17:04:57 2012
@@ -23,9 +23,11 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Locale;
 
 import org.apache.lucene.store.FSDirectory;
 
@@ -97,7 +99,7 @@ public class IndexSplitter {
   }
 
   public void listSegments() throws IOException {
-    DecimalFormat formatter = new DecimalFormat("###,###.###");
+    DecimalFormat formatter = new DecimalFormat("###,###.###", DecimalFormatSymbols.getInstance(Locale.ROOT));
     for (int x = 0; x < infos.size(); x++) {
       SegmentInfoPerCommit info = infos.info(x);
       String sizeStr = formatter.format(info.sizeInBytes());

Modified: lucene/dev/branches/lucene3312/lucene/misc/src/test/org/apache/lucene/index/TestPKIndexSplitter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/misc/src/test/org/apache/lucene/index/TestPKIndexSplitter.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/misc/src/test/org/apache/lucene/index/TestPKIndexSplitter.java (original)
+++ lucene/dev/branches/lucene3312/lucene/misc/src/test/org/apache/lucene/index/TestPKIndexSplitter.java Mon Jul  9 17:04:57 2012
@@ -18,7 +18,9 @@ package org.apache.lucene.index;
  */
 
 import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
 import java.text.NumberFormat;
+import java.util.Locale;
 
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.analysis.MockTokenizer;
@@ -32,7 +34,7 @@ import org.apache.lucene.util.LuceneTest
 public class TestPKIndexSplitter extends LuceneTestCase {
 
   public void testSplit() throws Exception {    
-    NumberFormat format = new DecimalFormat("000000000");
+    NumberFormat format = new DecimalFormat("000000000", DecimalFormatSymbols.getInstance(Locale.ROOT));
     Directory dir = newDirectory();
     IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(
         TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false))

Modified: lucene/dev/branches/lucene3312/lucene/queries/src/test/org/apache/lucene/queries/ChainedFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queries/src/test/org/apache/lucene/queries/ChainedFilterTest.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queries/src/test/org/apache/lucene/queries/ChainedFilterTest.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queries/src/test/org/apache/lucene/queries/ChainedFilterTest.java Mon Jul  9 17:04:57 2012
@@ -19,6 +19,8 @@ package org.apache.lucene.queries;
 
 import java.util.Calendar;
 import java.util.GregorianCalendar;
+import java.util.Locale;
+import java.util.TimeZone;
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
@@ -56,7 +58,8 @@ public class ChainedFilterTest extends L
     super.setUp();
     directory = newDirectory();
     RandomIndexWriter writer = new RandomIndexWriter(random(), directory);
-    Calendar cal = new GregorianCalendar();
+    // we use the default Locale/TZ since LuceneTestCase randomizes it
+    Calendar cal = new GregorianCalendar(TimeZone.getDefault(), Locale.getDefault());
     cal.clear();
     cal.setTimeInMillis(1041397200000L); // 2003 January 01
 
@@ -183,7 +186,7 @@ public class ChainedFilterTest extends L
 
   /*
   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);
   }
   */
   

Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/FastCharStream.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/FastCharStream.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/FastCharStream.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/FastCharStream.java Mon Jul  9 17:04:57 2012
@@ -99,7 +99,6 @@ public final class FastCharStream implem
     try {
       input.close();
     } catch (IOException e) {
-      System.err.println("Caught: " + e + "; ignoring.");
     }
   }
 

Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java Mon Jul  9 17:04:57 2012
@@ -71,6 +71,7 @@ public abstract class QueryParserBase {
   float fuzzyMinSim = FuzzyQuery.defaultMinSimilarity;
   int fuzzyPrefixLength = FuzzyQuery.defaultPrefixLength;
   Locale locale = Locale.getDefault();
+  TimeZone timeZone = TimeZone.getDefault();
 
   // the default date resolution
   DateTools.Resolution dateResolution = null;
@@ -316,7 +317,8 @@ public abstract class QueryParserBase {
   }
 
   /**
-   * Set locale used by date range parsing.
+   * Set locale used by date range parsing, lowercasing, and other
+   * locale-sensitive operations.
    */
   public void setLocale(Locale locale) {
     this.locale = locale;
@@ -328,6 +330,14 @@ public abstract class QueryParserBase {
   public Locale getLocale() {
     return locale;
   }
+  
+  public void setTimeZone(TimeZone timeZone) {
+    this.timeZone = timeZone;
+  }
+  
+  public TimeZone getTimeZone() {
+    return timeZone;
+  }
 
   /**
    * Sets the default date resolution used by RangeQueries for fields for which no
@@ -658,8 +668,8 @@ public abstract class QueryParserBase {
                                 boolean endInclusive) throws ParseException
   {
     if (lowercaseExpandedTerms) {
-      part1 = part1==null ? null : part1.toLowerCase();
-      part2 = part2==null ? null : part2.toLowerCase();
+      part1 = part1==null ? null : part1.toLowerCase(locale);
+      part2 = part2==null ? null : part2.toLowerCase(locale);
     }
 
 
@@ -677,7 +687,7 @@ public abstract class QueryParserBase {
         // The user can only specify the date, not the time, so make sure
         // the time is set to the latest possible time of that date to really
         // include all documents:
-        Calendar cal = Calendar.getInstance(locale);
+        Calendar cal = Calendar.getInstance(timeZone, locale);
         cal.setTime(d2);
         cal.set(Calendar.HOUR_OF_DAY, 23);
         cal.set(Calendar.MINUTE, 59);
@@ -935,7 +945,7 @@ public abstract class QueryParserBase {
     if (!allowLeadingWildcard && (termStr.startsWith("*") || termStr.startsWith("?")))
       throw new ParseException("'*' or '?' not allowed as first character in WildcardQuery");
     if (lowercaseExpandedTerms) {
-      termStr = termStr.toLowerCase();
+      termStr = termStr.toLowerCase(locale);
     }
     Term t = new Term(field, termStr);
     return newWildcardQuery(t);
@@ -964,7 +974,7 @@ public abstract class QueryParserBase {
   protected Query getRegexpQuery(String field, String termStr) throws ParseException
   {
     if (lowercaseExpandedTerms) {
-      termStr = termStr.toLowerCase();
+      termStr = termStr.toLowerCase(locale);
     }
     Term t = new Term(field, termStr);
     return newRegexpQuery(t);
@@ -998,7 +1008,7 @@ public abstract class QueryParserBase {
     if (!allowLeadingWildcard && termStr.startsWith("*"))
       throw new ParseException("'*' not allowed as first character in PrefixQuery");
     if (lowercaseExpandedTerms) {
-      termStr = termStr.toLowerCase();
+      termStr = termStr.toLowerCase(locale);
     }
     Term t = new Term(field, termStr);
     return newPrefixQuery(t);
@@ -1018,7 +1028,7 @@ public abstract class QueryParserBase {
   protected Query getFuzzyQuery(String field, String termStr, float minSimilarity) throws ParseException
   {
     if (lowercaseExpandedTerms) {
-      termStr = termStr.toLowerCase();
+      termStr = termStr.toLowerCase(locale);
     }
     Term t = new Term(field, termStr);
     return newFuzzyQuery(t, minSimilarity, fuzzyPrefixLength);

Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/QueryNodeImpl.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/QueryNodeImpl.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/QueryNodeImpl.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/nodes/QueryNodeImpl.java Mon Jul  9 17:04:57 2012
@@ -20,6 +20,7 @@ package org.apache.lucene.queryparser.fl
 import java.util.ArrayList;
 import java.util.Hashtable;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.ResourceBundle;
 
@@ -151,20 +152,20 @@ public abstract class QueryNodeImpl impl
   }
 
   public void setTag(String tagName, Object value) {
-    this.tags.put(tagName.toLowerCase(), value);
+    this.tags.put(tagName.toLowerCase(Locale.ROOT), value);
   }
 
   public void unsetTag(String tagName) {
-    this.tags.remove(tagName.toLowerCase());
+    this.tags.remove(tagName.toLowerCase(Locale.ROOT));
   }
 
   /** verify if a node contains a tag */
   public boolean containsTag(String tagName) {
-    return this.tags.containsKey(tagName.toLowerCase());
+    return this.tags.containsKey(tagName.toLowerCase(Locale.ROOT));
   }
 
   public Object getTag(String tagName) {
-    return this.tags.get(tagName.toString().toLowerCase());
+    return this.tags.get(tagName.toLowerCase(Locale.ROOT));
   }
 
   private QueryNode parent = null;

Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/util/UnescapedCharSequence.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/util/UnescapedCharSequence.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/util/UnescapedCharSequence.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/util/UnescapedCharSequence.java Mon Jul  9 17:04:57 2012
@@ -1,5 +1,7 @@
 package org.apache.lucene.queryparser.flexible.core.util;
 
+import java.util.Locale;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -146,12 +148,12 @@ public final class UnescapedCharSequence
     else return false;
   }
   
-  public static CharSequence toLowerCase(CharSequence text) {
+  public static CharSequence toLowerCase(CharSequence text, Locale locale) {
     if (text instanceof UnescapedCharSequence) {
-      char[] chars = text.toString().toLowerCase().toCharArray();
+      char[] chars = text.toString().toLowerCase(locale).toCharArray();
       boolean[] wasEscaped = ((UnescapedCharSequence)text).wasEscaped;
       return new UnescapedCharSequence(chars, wasEscaped, 0, chars.length);
     } else 
-      return new UnescapedCharSequence(text.toString().toLowerCase());
+      return new UnescapedCharSequence(text.toString().toLowerCase(locale));
   }
 }

Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/StandardQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/StandardQueryParser.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/StandardQueryParser.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/StandardQueryParser.java Mon Jul  9 17:04:57 2012
@@ -19,6 +19,7 @@ package org.apache.lucene.queryparser.fl
 
 import java.util.Locale;
 import java.util.Map;
+import java.util.TimeZone;
 import java.util.TooManyListenersException;
 
 import org.apache.lucene.analysis.Analyzer;
@@ -344,6 +345,14 @@ public class StandardQueryParser extends
     return getQueryConfigHandler().get(ConfigurationKeys.LOCALE);
   }
   
+  public void setTimeZone(TimeZone timeZone) {
+    getQueryConfigHandler().set(ConfigurationKeys.TIMEZONE, timeZone);
+  }
+  
+  public TimeZone getTimeZone() {
+    return getQueryConfigHandler().get(ConfigurationKeys.TIMEZONE);
+  }
+  
   /**
    * Sets the default slop for phrases. If zero, then exact phrase matches are
    * required. Default value is zero.

Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/StandardQueryConfigHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/StandardQueryConfigHandler.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/StandardQueryConfigHandler.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/StandardQueryConfigHandler.java Mon Jul  9 17:04:57 2012
@@ -21,6 +21,7 @@ import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Locale;
 import java.util.Map;
+import java.util.TimeZone;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.DateTools;
@@ -101,6 +102,8 @@ public class StandardQueryConfigHandler 
      */
     final public static ConfigurationKey<Locale> LOCALE = ConfigurationKey.newInstance();
     
+    final public static ConfigurationKey<TimeZone> TIMEZONE = ConfigurationKey.newInstance();
+    
     /**
      * Key used to set the {@link RewriteMethod} used when creating queries
      * 

Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericQueryNode.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericQueryNode.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericQueryNode.java Mon Jul  9 17:04:57 2012
@@ -90,8 +90,8 @@ public class NumericQueryNode extends Qu
    * @return the value converte to {@link String} and escaped
    */
   protected CharSequence getTermEscaped(EscapeQuerySyntax escaper) {
-    return escaper.escape(NumberFormat.getNumberInstance().format(this.value),
-        Locale.ENGLISH, Type.NORMAL);
+    return escaper.escape(numberFormat.format(this.value),
+        Locale.ROOT, Type.NORMAL);
   }
   
   public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser) {

Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/EscapeQuerySyntaxImpl.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/EscapeQuerySyntaxImpl.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/EscapeQuerySyntaxImpl.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/EscapeQuerySyntaxImpl.java Mon Jul  9 17:04:57 2012
@@ -50,7 +50,7 @@ public class EscapeQuerySyntaxImpl imple
 
     // regular escapable Char for terms
     for (int i = 0; i < escapableTermChars.length; i++) {
-      buffer = replaceIgnoreCase(buffer, escapableTermChars[i].toLowerCase(),
+      buffer = replaceIgnoreCase(buffer, escapableTermChars[i].toLowerCase(locale),
           "\\", locale);
     }
 
@@ -73,7 +73,7 @@ public class EscapeQuerySyntaxImpl imple
     CharSequence buffer = str;
 
     for (int i = 0; i < escapableQuotedChars.length; i++) {
-      buffer = replaceIgnoreCase(buffer, escapableTermChars[i].toLowerCase(),
+      buffer = replaceIgnoreCase(buffer, escapableTermChars[i].toLowerCase(locale),
           "\\", locale);
     }
     return buffer;
@@ -178,7 +178,7 @@ public class EscapeQuerySyntaxImpl imple
     CharSequence buffer = str;
 
     for (int i = 0; i < escapableWhiteChars.length; i++) {
-      buffer = replaceIgnoreCase(buffer, escapableWhiteChars[i].toLowerCase(),
+      buffer = replaceIgnoreCase(buffer, escapableWhiteChars[i].toLowerCase(locale),
           "\\", locale);
     }
     return buffer;

Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/ParseException.java Mon Jul  9 17:04:57 2012
@@ -193,4 +193,4 @@ public class ParseException extends Quer
    }
 
 }
-/* JavaCC - OriginalChecksum=0f25f4245374bbf9920c9a82efecadd2 (do not edit this line) */
+/* JavaCC - OriginalChecksum=7601d49d11bc059457ae5850628ebc8a (do not edit this line) */

Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java Mon Jul  9 17:04:57 2012
@@ -1,7 +1,7 @@
 /* Generated By:JavaCC: Do not edit this line. StandardSyntaxParser.java */
 package org.apache.lucene.queryparser.flexible.standard.parser;
 
-/*
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -49,14 +49,14 @@ public class StandardSyntaxParser implem
 
    // syntax parser constructor
    public StandardSyntaxParser() {
-        this(new StringReader(""));
+        this(new FastCharStream(new StringReader("")));
   }
      /** Parses a query string, returning a {@link org.apache.lucene.queryparser.flexible.core.nodes.QueryNode}.
      *  @param query  the query string to be parsed.
      *  @throws ParseException if the parsing fails
      */
     public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException {
-      ReInit(new StringReader(query.toString()));
+      ReInit(new FastCharStream(new StringReader(query.toString())));
       try {
         // TopLevelQuery is a Query followed by the end-of-input (EOF)
         QueryNode querynode = TopLevelQuery(field);
@@ -844,7 +844,6 @@ public class StandardSyntaxParser implem
 
   /** Generated Token Manager. */
   public StandardSyntaxParserTokenManager token_source;
-  JavaCharStream jj_input_stream;
   /** Current token. */
   public Token token;
   /** Next token. */
@@ -870,14 +869,9 @@ public class StandardSyntaxParser implem
   private boolean jj_rescan = false;
   private int jj_gc = 0;
 
-  /** Constructor with InputStream. */
-  public StandardSyntaxParser(java.io.InputStream stream) {
-     this(stream, null);
-  }
-  /** Constructor with InputStream and supplied encoding */
-  public StandardSyntaxParser(java.io.InputStream stream, String encoding) {
-    try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
-    token_source = new StandardSyntaxParserTokenManager(jj_input_stream);
+  /** Constructor with user supplied CharStream. */
+  public StandardSyntaxParser(CharStream stream) {
+    token_source = new StandardSyntaxParserTokenManager(stream);
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
@@ -886,35 +880,8 @@ public class StandardSyntaxParser implem
   }
 
   /** Reinitialise. */
-  public void ReInit(java.io.InputStream stream) {
-     ReInit(stream, null);
-  }
-  /** Reinitialise. */
-  public void ReInit(java.io.InputStream stream, String encoding) {
-    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
-    token_source.ReInit(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
-    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
-  }
-
-  /** Constructor. */
-  public StandardSyntaxParser(java.io.Reader stream) {
-    jj_input_stream = new JavaCharStream(stream, 1, 1);
-    token_source = new StandardSyntaxParserTokenManager(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 28; i++) jj_la1[i] = -1;
-    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
-  }
-
-  /** Reinitialise. */
-  public void ReInit(java.io.Reader stream) {
-    jj_input_stream.ReInit(stream, 1, 1);
-    token_source.ReInit(jj_input_stream);
+  public void ReInit(CharStream stream) {
+    token_source.ReInit(stream);
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;

Modified: lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj?rev=1359283&r1=1359282&r2=1359283&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj (original)
+++ lucene/dev/branches/lucene3312/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.jj Mon Jul  9 17:04:57 2012
@@ -5,7 +5,7 @@
 options {
   STATIC=false;
   JAVA_UNICODE_ESCAPE=true;
-  USER_CHAR_STREAM=false;
+  USER_CHAR_STREAM=true;
   IGNORE_CASE=false;
   JDK_VERSION="1.5";
 }
@@ -61,14 +61,14 @@ public class StandardSyntaxParser implem
  
    // syntax parser constructor
    public StandardSyntaxParser() {
-   	this(new StringReader(""));
+   	this(new FastCharStream(new StringReader("")));
   }
      /** Parses a query string, returning a {@link org.apache.lucene.queryparser.flexible.core.nodes.QueryNode}.
      *  @param query  the query string to be parsed.
      *  @throws ParseException if the parsing fails
      */
     public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException {
-      ReInit(new StringReader(query.toString()));
+      ReInit(new FastCharStream(new StringReader(query.toString())));
       try {
         // TopLevelQuery is a Query followed by the end-of-input (EOF)
         QueryNode querynode = TopLevelQuery(field);



Mime
View raw message