[ 
https://issues.apache.org/jira/browse/TIKA-3337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17309420#comment-17309420
 ] 

Tim Allison commented on TIKA-3337:
-----------------------------------

+1.  In 2.x, I'm trying to move these warnings to trigger only if the specific 
resource is required but not available.  Nevertheless, this looks like a good 
change.

> Imaging classes inflexibility in PDFParser.checkInitialization
> --------------------------------------------------------------
>
>                 Key: TIKA-3337
>                 URL: https://issues.apache.org/jira/browse/TIKA-3337
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 1.25
>            Reporter: Tilman Hausherr
>            Priority: Minor
>
> While looking for something else I saw this code 
> PDFParser.checkInitialization():
> {code}
>             StringBuilder sb = new StringBuilder();
>             try {
>                 
> Class.forName("com.github.jaiimageio.impl.plugins.tiff.TIFFImageWriter");
>             } catch (ClassNotFoundException e) {
>                 sb.append("TIFFImageWriter not loaded. tiff files will not be 
> processed\n");
>                 sb.append("See 
> https://pdfbox.apache.org/2.0/dependencies.html#jai-image-io\n";);
>                 sb.append("for optional dependencies.\n");
>             }
>             try {
>                 
> Class.forName("com.github.jaiimageio.jpeg2000.impl.J2KImageReader");
>             } catch (ClassNotFoundException e) {
>                 sb.append("J2KImageReader not loaded. JPEG2000 files will not 
> be processed.\n");
>                 sb.append("See 
> https://pdfbox.apache.org/2.0/dependencies.html#jai-image-io\n";);
>                 sb.append("for optional dependencies.\n");
>             }
> {code}
> This requires specific classes, i.e. wouldn't work with twelvemonkeys or the 
> old JAI. Proposed change:
> {code}
>             if (!ImageIO.getImageReadersByFormatName("tif").hasNext()) {
>                 sb.append("TIFFImageWriter not loaded. tiff files will not be 
> processed\n");
>                 sb.append("See 
> https://pdfbox.apache.org/2.0/dependencies.html#jai-image-io\n";);
>                 sb.append("for optional dependencies.\n");
>             }
>             if (!ImageIO.getImageReadersByFormatName("jpeg2000").hasNext()) {
>                 sb.append("J2KImageReader not loaded. JPEG2000 files will not 
> be processed.\n");
>                 sb.append("See 
> https://pdfbox.apache.org/2.0/dependencies.html#jai-image-io\n";);
>                 sb.append("for optional dependencies.\n");
>             }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to