Lucene - Core
  1. Lucene - Core
  2. LUCENE-3344

Add workaround for ICU bug in combination with Java7 to LuceneTestCase

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.4, 4.0-ALPHA
    • Component/s: modules/analysis
    • Labels:
    • Environment:

      JDK7

    • Lucene Fields:
      New, Patch Available

      Description

      There is a bug in ICU that makes it fail to load it ULocale class in Java7: http://bugs.icu-project.org/trac/ticket/8734

      The problem is caused by some new locales in Java 7, that lead to a chicken-and-egg problem in the static initializer of ULocale. It initializes its default locale from the JDK locale in a static ctor. Until the default ULocale instance is created, the default is not set in ULocale. But ULocales ctor itsself needs the default locale to fetch some ressource bundles and throws NPE.

      The code in LuceneTestCase that randomizes the default locale should classload ULocale before it tries to set another random locale, using a defined, safe locale (Locale.US). Patch is easy.

      1. LUCENE-3344.patch
        1 kB
        Uwe Schindler

        Activity

        Uwe Schindler created issue -
        Hide
        Uwe Schindler added a comment -

        Patch that tries to init ICU's ULocale before randomization by a simple Class.forName(). If ICU is not in classpath, its a no-op.

        Will commit soon.

        Show
        Uwe Schindler added a comment - Patch that tries to init ICU's ULocale before randomization by a simple Class.forName(). If ICU is not in classpath, its a no-op. Will commit soon.
        Uwe Schindler made changes -
        Field Original Value New Value
        Attachment LUCENE-3344.patch [ 12487855 ]
        Hide
        Robert Muir added a comment -

        nice workaround! +1 to commit

        Show
        Robert Muir added a comment - nice workaround! +1 to commit
        Hide
        Uwe Schindler added a comment -

        Committed trunk revision: 1151146
        Committed 3.x revision: 1151148

        Show
        Uwe Schindler added a comment - Committed trunk revision: 1151146 Committed 3.x revision: 1151148
        Uwe Schindler made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Uwe Schindler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        9m 19s 1 Uwe Schindler 26/Jul/11 16:59
        Resolved Resolved Closed Closed
        123d 20h 32m 1 Uwe Schindler 27/Nov/11 12:31

          People

          • Assignee:
            Uwe Schindler
            Reporter:
            Uwe Schindler
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development