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

Bug in TikaConfig / ServiceLoader

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.18
    • Fix Version/s: None
    • Component/s: config
    • Labels:
      None

      Description

      I have been puzzled by inability to turn off warning messages on the console during service loading, such as :

      [12:36:28]  Jun 20, 2018 12:36:28 PM org.apache.tika.config.InitializableProblemHandler$3 handleInitializableProblem

      Looking through the java source code, I can see that the problem may be in this method:

      TikaConfig.XmlLoader.loadOne()

      In this method, we initialize the initializableProblemHandler using default or using the user settings from xml config file, but this variable doesn't seem to get passed down to the createComposite() code or the service loader, so in the end the user settings from xml configuration file do not get taken into account.

      For reference, I have defined my tika config xml as so:

      <?xml version="1.0" encoding="UTF-8"?>
      <properties>
      <parsers>
      <!-- Default Parser for most things, except for 2 mime types, and never
      use the Executable Parser -->
      <parser class="org.apache.tika.parser.DefaultParser" initializableProblemHandler="IGNORE">
      <mime-exclude>image/jpeg</mime-exclude>
      <mime-exclude>application/pdf</mime-exclude>
      <parser-exclude class="org.apache.tika.parser.executable.ExecutableParser"/>
      </parser>
      <!-- Use a different parser for PDF -->
      <parser class="org.apache.tika.parser.EmptyParser">
      <mime>application/pdf</mime>
      </parser>
      </parsers>
      </properties>

      I am specifically trying to turn off messages for org.apache.tika.parser.pdf.PDFParser
      The messages are printed when executing java code:

      TikaConfig config = new TikaConfig("tika-config.xml");
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Olivier Olivier Schmitt
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: