You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Radu Coravu (JIRA)" <ji...@apache.org> on 2014/05/26 11:32:01 UTC

[jira] [Commented] (FOP-2369) Call "javax.imageio.ImageReader.canReadRaster()" before attempt to read raster

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

Radu Coravu commented on FOP-2369:
----------------------------------

Hi Luis,

In that case the "org.apache.xmlgraphics.image.loader.impl.imageio.ImageLoaderImageIO.getFallbackBufferedImage(ImageReader, int, ImageReadParam)" should return null.

The code already has fallbacks for this:

{code} if (firstException != null) {
            throw new ImageException("Error while loading image: "
                    + firstException.getMessage(), firstException);
        }
        if (imageData == null) {
            throw new ImageException("No ImageIO ImageReader found .");
        }{code}

I'm sorry, I cannot provide a patch, I do not have a checkout of the latest FOP Java sources but the fix should be pretty simple and straight forward.

> Call "javax.imageio.ImageReader.canReadRaster()" before attempt to read raster
> ------------------------------------------------------------------------------
>
>                 Key: FOP-2369
>                 URL: https://issues.apache.org/jira/browse/FOP-2369
>             Project: Fop
>          Issue Type: Bug
>          Components: images
>    Affects Versions: 1.1
>            Reporter: Radu Coravu
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> The method:
> org.apache.xmlgraphics.image.loader.impl.imageio.ImageLoaderImageIO.getFallbackBufferedImage(ImageReader, int, ImageReadParam)
> calls:
> reader.readRaster(pageIndex, param);
> but it should first call "javax.imageio.ImageReader.canReadRaster()" to see if the reader can render the raster.
> Otherwise if the image reader cannot render rasters such exceptions may occur:
> {code}      [fop] Caused by: java.lang.UnsupportedOperationException
>       [fop] 	at com.oxygenxml.media.imageioimpl.plugins.tiff.TIFFImageReader.readRaster(Unknown Source)
>       [fop] 	at org.apache.xmlgraphics.image.loader.impl.imageio.ImageLoaderImageIO.getFallbackBufferedImage(ImageLoaderImageIO.java:356)
>       [fop] 	at org.apache.xmlgraphics.image.loader.impl.imageio.ImageLoaderImageIO.loadImage(ImageLoaderImageIO.java:157)
>       [fop] 	at org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline.execute(ImageProviderPipeline.java:154)
>       [fop] 	at org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline.execute(ImageProviderPipeline.java:99){code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)