Details

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

      Description

      This test wasn't working at all, it would always pass.

      It is sensitive to the strings inside exception messages, if we change those, it might suddenly stop working.

      It would be great to improve this thing to be less fragile.

      1. LUCENE-5630.patch
        4 kB
        Uwe Schindler

        Activity

        Hide
        Uwe Schindler added a comment -

        This patch fixes the issue.

        In fact the whole check was wrong and really to fragile. The new approach is 100% safe:

        • Separately lookup the class before doing anything. If this throws any exception, then the component is really missing
        • Then do the same checks as before (to actually check that instantiation works), but don't check the message. Its easier. The newInstance method throws IAE, which wraps a NoSuchMethodException -> so just check IAE#getCause()

        I will commit this fix to all three branches.

        Show
        Uwe Schindler added a comment - This patch fixes the issue. In fact the whole check was wrong and really to fragile. The new approach is 100% safe: Separately lookup the class before doing anything. If this throws any exception, then the component is really missing Then do the same checks as before (to actually check that instantiation works), but don't check the message. Its easier. The newInstance method throws IAE, which wraps a NoSuchMethodException -> so just check IAE#getCause() I will commit this fix to all three branches.
        Hide
        Robert Muir added a comment -

        Looks great, thanks!

        Show
        Robert Muir added a comment - Looks great, thanks!
        Hide
        ASF subversion and git services added a comment -

        Commit 1589870 from Uwe Schindler in branch 'dev/trunk'
        [ https://svn.apache.org/r1589870 ]

        LUCENE-5630: Fix TestAllAnalyzersHaveFactories to correctly check for existence of class and corresponding Map<String,String> ctor

        Show
        ASF subversion and git services added a comment - Commit 1589870 from Uwe Schindler in branch 'dev/trunk' [ https://svn.apache.org/r1589870 ] LUCENE-5630 : Fix TestAllAnalyzersHaveFactories to correctly check for existence of class and corresponding Map<String,String> ctor
        Hide
        ASF subversion and git services added a comment -

        Commit 1589872 from Uwe Schindler in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1589872 ]

        Merged revision(s) 1589870 from lucene/dev/trunk:
        LUCENE-5630: Fix TestAllAnalyzersHaveFactories to correctly check for existence of class and corresponding Map<String,String> ctor

        Show
        ASF subversion and git services added a comment - Commit 1589872 from Uwe Schindler in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1589872 ] Merged revision(s) 1589870 from lucene/dev/trunk: LUCENE-5630 : Fix TestAllAnalyzersHaveFactories to correctly check for existence of class and corresponding Map<String,String> ctor
        Hide
        ASF subversion and git services added a comment -

        Commit 1589874 from Uwe Schindler in branch 'dev/branches/lucene_solr_4_8'
        [ https://svn.apache.org/r1589874 ]

        Merged revision(s) 1589872 from lucene/dev/branches/branch_4x:
        Merged revision(s) 1589870 from lucene/dev/trunk:
        LUCENE-5630: Fix TestAllAnalyzersHaveFactories to correctly check for existence of class and corresponding Map<String,String> ctor

        Show
        ASF subversion and git services added a comment - Commit 1589874 from Uwe Schindler in branch 'dev/branches/lucene_solr_4_8' [ https://svn.apache.org/r1589874 ] Merged revision(s) 1589872 from lucene/dev/branches/branch_4x: Merged revision(s) 1589870 from lucene/dev/trunk: LUCENE-5630 : Fix TestAllAnalyzersHaveFactories to correctly check for existence of class and corresponding Map<String,String> ctor
        Hide
        Uwe Schindler added a comment -

        Thanks Robert for reporting!

        Show
        Uwe Schindler added a comment - Thanks Robert for reporting!
        Hide
        Uwe Schindler added a comment -

        Close issue after release of 4.8.0

        Show
        Uwe Schindler added a comment - Close issue after release of 4.8.0

          People

          • Assignee:
            Uwe Schindler
            Reporter:
            Robert Muir
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development