[
https://issues.apache.org/jira/browse/PDFBOX-6060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18018083#comment-18018083
]
Simon Steiner commented on PDFBOX-6060:
---------------------------------------
That would mean all users are switched to 12 monkeys, which is quite risky
> Allow use of 12 monkeys in DCTFilter
> ------------------------------------
>
> Key: PDFBOX-6060
> URL: https://issues.apache.org/jira/browse/PDFBOX-6060
> Project: PDFBox
> Issue Type: Bug
> Reporter: Simon Steiner
> Priority: Major
>
> DCTFilter calls findRasterReader and returns the first reader, on error it
> should try the 2nd reader as JDK cant read all jpegs
> {code:java}
> public final DecodeResult decode(InputStream encoded, OutputStream decoded,
> COSDictionary parameters, int index)
> throws IOException {
> Iterator<ImageReader> readers =
> ImageIO.getImageReadersByFormatName("JPEG");
> ImageInputStream iis = ImageIO.createImageInputStream(encoded);
> iis.mark();
> Exception exception = null;
> String error = "Cannot read JPEG image: a suitable JAI I/O image
> filter is not installed";
> try {
> while (readers.hasNext()) {
> ImageReader reader = readers.next();
> if (reader.canReadRaster()) {
> try {
> reader.setInput(iis);
> //...
> } catch (Exception e) {
> exception = e;
> error = e.getMessage();
> iis.reset();
> continue;
> } finally {
> reader.dispose();
> }
> return new DecodeResult(parameters);
> }
> }
> } finally {
> iis.close();
> }
> throw new RuntimeException(error, exception);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]