You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/07/07 16:30:53 UTC

svn commit: r1358575 - in /lucene/dev/branches/lucene4199/lucene: analysis/common/src/java/org/apache/lucene/analysis/hunspell/ analysis/common/src/test/org/apache/lucene/analysis/util/ core/src/java/org/apache/lucene/util/ core/src/test/org/apache/luc...

Author: rmuir
Date: Sat Jul  7 14:30:52 2012
New Revision: 1358575

URL: http://svn.apache.org/viewvc?rev=1358575&view=rev
Log:
LUCENE-4199: fix some String.formats

Modified:
    lucene/dev/branches/lucene4199/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/HunspellDictionary.java
    lucene/dev/branches/lucene4199/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestCharArraySet.java
    lucene/dev/branches/lucene4199/lucene/core/src/java/org/apache/lucene/util/NamedThreadFactory.java
    lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java
    lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
    lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java

Modified: lucene/dev/branches/lucene4199/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/HunspellDictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4199/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/HunspellDictionary.java?rev=1358575&r1=1358574&r2=1358575&view=diff
==============================================================================
--- lucene/dev/branches/lucene4199/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/HunspellDictionary.java (original)
+++ lucene/dev/branches/lucene4199/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/HunspellDictionary.java Sat Jul  7 14:30:52 2012
@@ -252,7 +252,7 @@ public class HunspellDictionary {
       }
 
       String condition = ruleArgs[4];
-      affix.setCondition(condition, String.format(conditionPattern, condition));
+      affix.setCondition(condition, String.format(Locale.ROOT, conditionPattern, condition));
       affix.setCrossProduct(crossProduct);
       
       List<HunspellAffix> list = affixes.get(affix.getAppend());

Modified: lucene/dev/branches/lucene4199/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestCharArraySet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4199/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestCharArraySet.java?rev=1358575&r1=1358574&r2=1358575&view=diff
==============================================================================
--- lucene/dev/branches/lucene4199/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestCharArraySet.java (original)
+++ lucene/dev/branches/lucene4199/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestCharArraySet.java Sat Jul  7 14:30:52 2012
@@ -208,16 +208,16 @@ public class TestCharArraySet extends Lu
       set.add(upper);
     }
     for (int i = 0; i < upperArr.length; i++) {
-      assertTrue(String.format(missing, upperArr[i]), set.contains(upperArr[i]));
-      assertTrue(String.format(missing, lowerArr[i]), set.contains(lowerArr[i]));
+      assertTrue(String.format(Locale.ROOT, missing, upperArr[i]), set.contains(upperArr[i]));
+      assertTrue(String.format(Locale.ROOT, missing, lowerArr[i]), set.contains(lowerArr[i]));
     }
     set = new CharArraySet(TEST_VERSION_CURRENT, Arrays.asList(TEST_STOP_WORDS), false);
     for (String upper : upperArr) {
       set.add(upper);
     }
     for (int i = 0; i < upperArr.length; i++) {
-      assertTrue(String.format(missing, upperArr[i]), set.contains(upperArr[i]));
-      assertFalse(String.format(falsePos, lowerArr[i]), set.contains(lowerArr[i]));
+      assertTrue(String.format(Locale.ROOT, missing, upperArr[i]), set.contains(upperArr[i]));
+      assertFalse(String.format(Locale.ROOT, falsePos, lowerArr[i]), set.contains(lowerArr[i]));
     }
   }
   
@@ -235,8 +235,8 @@ public class TestCharArraySet extends Lu
       set.add(upper);
     }
     for (int i = 0; i < upperArr.length; i++) {
-      assertTrue(String.format(missing, upperArr[i]), set.contains(upperArr[i]));
-      assertTrue(String.format(missing, lowerArr[i]), set.contains(lowerArr[i]));
+      assertTrue(String.format(Locale.ROOT, missing, upperArr[i]), set.contains(upperArr[i]));
+      assertTrue(String.format(Locale.ROOT, missing, lowerArr[i]), set.contains(lowerArr[i]));
     }
     set = new CharArraySet(TEST_VERSION_CURRENT, Arrays.asList(TEST_STOP_WORDS),
         false);
@@ -244,8 +244,8 @@ public class TestCharArraySet extends Lu
       set.add(upper);
     }
     for (int i = 0; i < upperArr.length; i++) {
-      assertTrue(String.format(missing, upperArr[i]), set.contains(upperArr[i]));
-      assertFalse(String.format(falsePos, upperArr[i]), set
+      assertTrue(String.format(Locale.ROOT, missing, upperArr[i]), set.contains(upperArr[i]));
+      assertFalse(String.format(Locale.ROOT, falsePos, upperArr[i]), set
           .contains(lowerArr[i]));
     }
   }

Modified: lucene/dev/branches/lucene4199/lucene/core/src/java/org/apache/lucene/util/NamedThreadFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4199/lucene/core/src/java/org/apache/lucene/util/NamedThreadFactory.java?rev=1358575&r1=1358574&r2=1358575&view=diff
==============================================================================
--- lucene/dev/branches/lucene4199/lucene/core/src/java/org/apache/lucene/util/NamedThreadFactory.java (original)
+++ lucene/dev/branches/lucene4199/lucene/core/src/java/org/apache/lucene/util/NamedThreadFactory.java Sat Jul  7 14:30:52 2012
@@ -17,6 +17,7 @@ package org.apache.lucene.util;
  * limitations under the License.
  */
 
+import java.util.Locale;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -43,7 +44,7 @@ public class NamedThreadFactory implemen
     final SecurityManager s = System.getSecurityManager();
     group = (s != null) ? s.getThreadGroup() : Thread.currentThread()
         .getThreadGroup();
-    this.threadNamePrefix = String.format(NAME_PATTERN,
+    this.threadNamePrefix = String.format(Locale.ROOT, NAME_PATTERN,
         checkPrefix(threadNamePrefix), threadPoolNumber.getAndIncrement());
   }
 
@@ -57,7 +58,7 @@ public class NamedThreadFactory implemen
    * @see java.util.concurrent.ThreadFactory#newThread(java.lang.Runnable)
    */
   public Thread newThread(Runnable r) {
-    final Thread t = new Thread(group, r, String.format("%s-%d",
+    final Thread t = new Thread(group, r, String.format(Locale.ROOT, "%s-%d",
         this.threadNamePrefix, threadNumber.getAndIncrement()), 0);
     t.setDaemon(false);
     t.setPriority(Thread.NORM_PRIORITY);

Modified: lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java?rev=1358575&r1=1358574&r2=1358575&view=diff
==============================================================================
--- lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java (original)
+++ lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java Sat Jul  7 14:30:52 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;
@@ -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/lucene4199/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java?rev=1358575&r1=1358574&r2=1358575&view=diff
==============================================================================
--- lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java (original)
+++ lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java Sat Jul  7 14:30:52 2012
@@ -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/lucene4199/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java?rev=1358575&r1=1358574&r2=1358575&view=diff
==============================================================================
--- lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java (original)
+++ lucene/dev/branches/lucene4199/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java Sat Jul  7 14:30:52 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()),