Bug 41149 - PNG causes NPE for RTF output
Summary: PNG causes NPE for RTF output
Status: NEW
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: rtf (show other bugs)
Version: trunk
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-11 06:33 UTC by Chris Bowditch
Modified: 2012-04-11 06:17 UTC (History)
0 users



Attachments
PNG (161.42 KB, image/png)
2006-12-11 06:34 UTC, Chris Bowditch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Bowditch 2006-12-11 06:33:33 UTC
Attached PNG causes a NPE when rendering to RTF. Submitted by Dominic Brugger 
(brugger.at.puzzle.ch) Stack trace below:

SEVERE: Error while handling an external-graphic: null
java.lang.NullPointerException
        at org.apache.commons.io.IOUtils.copy(IOUtils.java:920)
        at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:215)
        at org.apache.fop.image.AbstractFopImage.loadDefaultOriginalData
(AbstractFopImage.java:223)
        at org.apache.fop.image.ImageIOImage.loadOriginalData
(ImageIOImage.java:217)
        at org.apache.fop.image.AbstractFopImage.load
(AbstractFopImage.java:174)
        at org.apache.fop.render.rtf.RTFHandler.image(RTFHandler.java:1131)
        at org.apache.fop.render.rtf.RTFHandler.invokeDeferredEvent
(RTFHandler.java:1492)
        at org.apache.fop.render.rtf.RTFHandler.recurseFONode
(RTFHandler.java:1616)
        at org.apache.fop.render.rtf.RTFHandler.recurseFONode
(RTFHandler.java:1687)
        at org.apache.fop.render.rtf.RTFHandler.recurseFONode
(RTFHandler.java:1687)
        at org.apache.fop.render.rtf.RTFHandler.recurseFONode
(RTFHandler.java:1639)
        at org.apache.fop.render.rtf.RTFHandler.endPageSequence
(RTFHandler.java:
Comment 1 Chris Bowditch 2006-12-11 06:34:53 UTC
Created attachment 19242 [details]
PNG
Comment 2 Jeremias Maerki 2006-12-11 12:09:26 UTC
Yet another reason for a redesign of the image package. The reason for the NPE
is the loadBitmap() call in ImageIOImage.loadDimensions(). The class decodes the
full image in order to get at the dimensions and loadBitmap() closes the
InputStream when it's done.

I don't have time right now to test that it won't break anything but one could
change loadDimensions() in ImageIOImage so it doesn't call loadBitmap() if it
has the resolution and extents of the image (which it can get from the
ImageReader). When this is done all image formats that are registered in
ImageFactory for loading with ImageIOImage need to be retested with RTF and at
least PDF output.

HTH
Comment 3 Glenn Adams 2012-04-07 01:42:58 UTC
resetting P2 open bugs to P3 pending further review
Comment 4 Glenn Adams 2012-04-11 06:17:15 UTC
change status from ASSIGNED to NEW for consistency