Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-6961

Improve Exception handling in AnalysisFactory/SPI loader

    Details

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

      Description

      Currently the AnalysisSPILoader used by AbstractAnalysisFactory uses a catch Exception block when invoking the constructor. If the constructor throws stuff like IllegalArgumentExceptions or similar, this is hidden inside InvocationTargetException, which gets wrapped in IllegalArgumentException. This is not useful.

      This patch will:

      • Only catch ReflectiveOperationException
      • If it is InvocationTargetException it will rethrow the cause, if it is unchecked. Otherwise it will wrap in RuntimeException
      • If the constructor cannot be called at all (reflective access denied, method not found,...) UOE is thrown with explaining message.

      This patch will be required by next version of LUCENE-6958.

      1. LUCENE-6961.patch
        4 kB
        Uwe Schindler

        Issue Links

          Activity

          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1723014 from Uwe Schindler in branch 'dev/branches/branch_5x'
          [ https://svn.apache.org/r1723014 ]

          Merged revision(s) 1723013 from lucene/dev/trunk:
          LUCENE-6961: Add exception message; make method private

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1723014 from Uwe Schindler in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1723014 ] Merged revision(s) 1723013 from lucene/dev/trunk: LUCENE-6961 : Add exception message; make method private
          Hide
          jira-bot ASF subversion and git services added a comment -

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

          LUCENE-6961: Add exception message; make method private

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1723013 from Uwe Schindler in branch 'dev/trunk' [ https://svn.apache.org/r1723013 ] LUCENE-6961 : Add exception message; make method private
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1722994 from Uwe Schindler in branch 'dev/branches/branch_5x'
          [ https://svn.apache.org/r1722994 ]

          Merged revision(s) 1722993 from lucene/dev/trunk:
          LUCENE-6961: Improve Exception handling in AnalysisFactories / AnalysisSPILoader: Don't wrap exceptions occuring in factory's ctor inside InvocationTargetException

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1722994 from Uwe Schindler in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1722994 ] Merged revision(s) 1722993 from lucene/dev/trunk: LUCENE-6961 : Improve Exception handling in AnalysisFactories / AnalysisSPILoader: Don't wrap exceptions occuring in factory's ctor inside InvocationTargetException
          Hide
          jira-bot ASF subversion and git services added a comment -

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

          LUCENE-6961: Improve Exception handling in AnalysisFactories / AnalysisSPILoader: Don't wrap exceptions occuring in factory's ctor inside InvocationTargetException

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1722993 from Uwe Schindler in branch 'dev/trunk' [ https://svn.apache.org/r1722993 ] LUCENE-6961 : Improve Exception handling in AnalysisFactories / AnalysisSPILoader: Don't wrap exceptions occuring in factory's ctor inside InvocationTargetException
          Hide
          thetaphi Uwe Schindler added a comment -

          Patch.

          Show
          thetaphi Uwe Schindler added a comment - Patch.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development