lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1151148 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/backwards/ lucene/backwards/src/test-framework/ lucene/backwards/src/test/ lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java solr/
Date Tue, 26 Jul 2011 15:58:54 GMT
Author: uschindler
Date: Tue Jul 26 15:58:53 2011
New Revision: 1151148

URL: http://svn.apache.org/viewvc?rev=1151148&view=rev
Log:
LUCENE-3344: Add workaround for ICU bug during ULocale classloading with some Java7-only locales

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/src/test/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/src/test-framework/   (props changed)
    lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
    lucene/dev/branches/branch_3x/solr/   (props changed)

Modified: lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java?rev=1151148&r1=1151147&r2=1151148&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
Tue Jul 26 15:58:53 2011
@@ -230,6 +230,9 @@ public abstract class LuceneTestCase ext
     random.setSeed(staticSeed);
     random.initialized = true;
   }
+  
+  @Deprecated
+  private static boolean icuTested = false;
 
   @BeforeClass
   public static void beforeClassLuceneTestCaseJ4() {
@@ -248,7 +251,23 @@ public abstract class LuceneTestCase ext
       random.nextInt(); // consume RandomCodecProvider's seed.
     }
     // end compatibility random-consumption
+    
     savedLocale = Locale.getDefault();
+    
+    // START hack to init ICU safely before we randomize locales.
+    // ICU fails during classloading when a special Java7-only locale is the default
+    // see: http://bugs.icu-project.org/trac/ticket/8734
+    if (!icuTested) {
+      icuTested = true;
+      try {
+        Locale.setDefault(Locale.US);
+        Class.forName("com.ibm.icu.util.ULocale");
+      } catch (ClassNotFoundException cnfe) {
+        // ignore if no ICU is in classpath
+      }
+    }
+    // END hack
+    
     locale = TEST_LOCALE.equals("random") ? randomLocale(random) : localeForName(TEST_LOCALE);
     Locale.setDefault(locale);
     savedTimeZone = TimeZone.getDefault();



Mime
View raw message