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

TikaConfig: unspecified attribute of "xml-reader-utils" breaks configuration file parser

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.27, 2.1.0
    • 2.2.0
    • config
    • None

    Description

      The Tika configuration file parser exits with an exception when the XMLReaderUtils are configured in tika-config.xml without specifying all possible attributes, eg. without the attribute maxEntityExpansions (to use the default value):

      <xml-reader-utils poolSize="20" />
      

      There's a test whether the attribute value is null - however, getAttribute() returns the empty string if the attribute is not present. The empty string then causes a NumberFormatException:

      2021-09-14 09:57:12,357 ERROR o.a.n.p.t.TikaParser [main] Problem loading custom Tika configuration from tika-config.xml
      java.lang.NumberFormatException: For input string: ""
              at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:?]
              at java.lang.Integer.parseInt(Integer.java:662) ~[?:?]
              at java.lang.Integer.parseInt(Integer.java:770) ~[?:?]
              at org.apache.tika.config.TikaConfig.updateXMLReaderUtils(TikaConfig.java:303) ~[tika-core-1.25.jar:1.25]
              at org.apache.tika.config.TikaConfig.<init>(TikaConfig.java:192) ~[tika-core-1.25.jar:1.25]
              at org.apache.tika.config.TikaConfig.<init>(TikaConfig.java:182) ~[tika-core-1.25.jar:1.25]
              at org.apache.tika.config.TikaConfig.<init>(TikaConfig.java:157) ~[tika-core-1.25.jar:1.25]
              at org.apache.nutch.parse.tika.TikaParser.setConf(TikaParser.java:276) [parse-tika.jar:?]
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              snagel Sebastian Nagel
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: