Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.3, 6.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Kuromoji user dictionary takes Reader and allows for comments and other lines to be ignored. But if its "empty" in the sense of no actual entries, the returned FST will be null, and it will throw a confusing NPE.

      JapaneseTokenizer and JapaneseAnalyzer apis already treat null UserDictionary as having none at all, so I think the best fix is to fix the UserDictionary api from UserDictionary(Reader) to UserDictionary.open(Reader) or similar, and return null if the FST is empty.

        Activity

        Hide
        Christian Moen added a comment -

        Good catch. I can look into a patch for this.

        Show
        Christian Moen added a comment - Good catch. I can look into a patch for this.
        Hide
        Jun Ohtani added a comment -

        I created the patch for this issue.
        Add open(Reader reader) static method to UserDictionary.
        And add test empty user dict.

        Please review this patch.

        Show
        Jun Ohtani added a comment - I created the patch for this issue. Add open(Reader reader) static method to UserDictionary. And add test empty user dict. Please review this patch.
        Hide
        ASF subversion and git services added a comment -

        Commit 1678685 from Christian Moen in branch 'dev/trunk'
        [ https://svn.apache.org/r1678685 ]

        Fix for empty Kuromoji user dictionary NPE (LUCENE-6468)

        Show
        ASF subversion and git services added a comment - Commit 1678685 from Christian Moen in branch 'dev/trunk' [ https://svn.apache.org/r1678685 ] Fix for empty Kuromoji user dictionary NPE ( LUCENE-6468 )
        Hide
        ASF subversion and git services added a comment -

        Commit 1678702 from Christian Moen in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1678702 ]

        Merged r1678685 from trunk (LUCENE-6468)

        Show
        ASF subversion and git services added a comment - Commit 1678702 from Christian Moen in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1678702 ] Merged r1678685 from trunk ( LUCENE-6468 )
        Hide
        Christian Moen added a comment -

        Thanks, Ohtani-san!

        I added a final being required for branch_5x for JDK 1.7 and also changed the empty user dictionary test to contain a user dictionary with a comment and some newlines (it's still empty, though).

        I've committed your patch to trunk and branch_5x.

        Show
        Christian Moen added a comment - Thanks, Ohtani-san! I added a final being required for branch_5x for JDK 1.7 and also changed the empty user dictionary test to contain a user dictionary with a comment and some newlines (it's still empty, though). I've committed your patch to trunk and branch_5x .
        Hide
        Shalin Shekhar Mangar added a comment -

        Bulk close for 5.3.0 release

        Show
        Shalin Shekhar Mangar added a comment - Bulk close for 5.3.0 release

          People

          • Assignee:
            Christian Moen
            Reporter:
            Robert Muir
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development