Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-1750

CachedTranslator.isAvailable() throws NPE when underlying translator is null

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.11
    • Component/s: translation
    • Labels:
      None
    • Flags:
      Patch

      Description

      When initialized with no underlying translator, CachedTranslator throws NPE when calling isAvailable(), although a user should initialize the translator (as it says in the default constructor's javadoc), it doesn't always happen and since CachedTranslator is defined as a registered service in tika-translate\src\main\resources\META-INF\services\org.apache.tika.language.translate.Translator, it normally doesn't (causing DumpTikaConfigExampleTest to fail).

      Since CachedTranslator is returning the source text when calling translate(String, String, String) when the translator is null, it makes sense that isAvailable returns false under the same condition.

        Attachments

        1. TIKA-1750.patch
          2 kB
          Yaniv Kunda

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kunda Yaniv Kunda
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: