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.

        Attachments

          Issue Links

            Activity

              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: