Details
Description
I am writing a Java application; and have pulled in Any23 2.2 from Maven Central. I am having issues with the suppression of the following Tika warnings:
org.apache.tika.config.InitializableProblemHandler$3 handleInitializableProblem WARNING: JBIG2ImageReader not loaded. jbig2 files will be ignored See https://pdfbox.apache.org/2.0/dependencies.html#jai-image-io for optional dependencies. TIFFImageWriter not loaded. tiff files will not be processed See https://pdfbox.apache.org/2.0/dependencies.html#jai-image-io for optional dependencies. J2KImageReader not loaded. JPEG2000 files will not be processed. See https://pdfbox.apache.org/2.0/dependencies.html#jai-image-io for optional dependencies.
Now, I understand I can just pull in these dependancies; but that then introduces licensing issues.
I have also searched around the for other solutions. I have seen many issue reports that claim the fix is to quash the warnings using a tika-config.xml file. The suggested fixes are slightly ambiguous to me.
I was unsure whether to use 'tiki.confg' or 'tika.config.file' for the System Property for the config file. I was also unsure whether to set either of the following:
- <service-loader initializableProblemHandler="ignore"/>
- <service-loader loadErrorHandler="ignore"/>
Regardless, I have tried all combinations to no avail. When constructing an Any23 instance, I still get the warnings.
I then had a quick look through the code and the Any23 class has a Mime Type Detector:
private MIMETypeDetector mimeTypeDetector = new TikaMIMETypeDetector( new WhiteSpacesPurifier() );
This in turn constructs a TikaConfig from the following resource:
public static final String RESOURCE_NAME = "/org/apache/any23/mime/tika-config.xml";
This configuration file certainly does not include the aforementioned methods of suppressing the warnings; and as far as I can determine will override any configuration file that I could inject.
From stepping through the code the warnings appear whilst constructing TikaMIMETypeDetector.
So, am I missing something; or is there no way to suppress these warnings?
When looking for solutions to this I have seen the same warnings in the traces for other bugs. I assume these authors are maybe not worried about these?
Thanks for any advice, and I apologise if I have not selected the correct components etc. for the issue.