[
https://issues.apache.org/jira/browse/PDFBOX-6060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Simon Steiner updated PDFBOX-6060:
----------------------------------
Description:
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();
try {
while (readers.hasNext()) {
ImageReader reader = readers.next();
if (reader.canReadRaster()) {
try {
reader.setInput(iis);
//...
} catch (Exception e) {
LOG.warn(e);
iis.reset();
continue;
} finally {
reader.dispose();
}
return new DecodeResult(parameters);
}
}
} finally {
iis.close();
}
throw new MissingImageReaderException("Cannot read JPEG image: a
suitable JAI I/O image filter is not installed");
}
{code}
was:DCTFilter calls findRasterReader and returns the first reader, on error
it should try the 2nd reader as JDK cant read all jpegs
> 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();
> try {
> while (readers.hasNext()) {
> ImageReader reader = readers.next();
> if (reader.canReadRaster()) {
> try {
> reader.setInput(iis);
> //...
> } catch (Exception e) {
> LOG.warn(e);
> iis.reset();
> continue;
> } finally {
> reader.dispose();
> }
> return new DecodeResult(parameters);
> }
> }
> } finally {
> iis.close();
> }
> throw new MissingImageReaderException("Cannot read JPEG image: a
> suitable JAI I/O image filter is not installed");
> }
> {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]