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 "Andreas L. Delmelle (JIRA)" <ji...@apache.org> on 2015/05/18 19:19:01 UTC
[jira] [Commented] (FOP-2343) Using incorrect inline image leads to
strange exception
[ https://issues.apache.org/jira/browse/FOP-2343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14548323#comment-14548323 ]
Andreas L. Delmelle commented on FOP-2343:
------------------------------------------
Needs to logged against XGC:
The data: URI in question is being passed as is to the XMLGraphics Commons' image preloader, from where the error is raised. So, FOP can do very little about this.
A quick debug session and ad hoc added exception handler in ExternalGraphic.bind() reveals the wrapped throwable:
java.lang.reflect.UndeclaredThrowableException
-> java.lang.reflect.InvocationTargetException
-> java.io.EOFException
Thrown from PreloaderEPS.preLoadImage(), which tries to read an unsigned int from the input stream, but that stream contains nothing...
Solution seems as simple as to add a handler there, and simply rethrow it. FOP will then handle the rest, as an EOFException is a subclass of IOException, which is already caught and reported.
> Using incorrect inline image leads to strange exception
> -------------------------------------------------------
>
> Key: FOP-2343
> URL: https://issues.apache.org/jira/browse/FOP-2343
> Project: Fop
> Issue Type: Bug
> Reporter: Frank Spies
>
> When using an "empty" inline image (like url('data:image/png;base64,')), an java.lang.reflect.UndeclaredThrowableException is thrown (instead of just ignoring the empty image or throwing a more meaningful exception)
> <?xml version="1.0" encoding="UTF-8"?>
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fn="http://www.w3.org/2006/xpath-functions" >
> <fo:layout-master-set>
> <fo:simple-page-master margin-top="15mm" margin-right="4mm" margin-left="20mm" margin-bottom="10mm" page-height="297mm" page-width="210mm" master-name="pageMaster.ersteSeite">
> <fo:region-body margin-top="60mm" margin-right="0mm" margin-left="0mm" margin-bottom="10mm" />
> <fo:region-before region-name="regionBeforeErsteSeite" precedence="false" extent="60mm" />
> <fo:region-after region-name="regionAfterOhneBarcode" precedence="false" extent="6mm" />
> <fo:region-start extent="0mm" />
> <fo:region-end extent="45mm" />
> </fo:simple-page-master>
> <fo:page-sequence-master master-name="pageMaster.gsubBericht">
> <fo:repeatable-page-master-alternatives>
> <fo:conditional-page-master-reference page-position="first" master-reference="pageMaster.ersteSeite" />
> <fo:conditional-page-master-reference page-position="rest" master-reference="pageMaster.ersteSeite" />
> </fo:repeatable-page-master-alternatives>
> </fo:page-sequence-master>
> </fo:layout-master-set>
> <fo:page-sequence master-reference="pageMaster.gsubBericht">
> <fo:static-content flow-name="regionBeforeErsteSeite">
> <fo:block />
> </fo:static-content>
> <fo:static-content flow-name="regionAfterOhneBarcode">
> <fo:block />
> </fo:static-content>
> <fo:flow margin-left="5cm" margin-top="1em" text-align="justify" flow-name="xsl-region-body">
> <fo:block>
> <fo:external-graphic content-width="scale-down-to-fit" content-height="scale-to-fit" height="20mm" width="35mm" src="url('data:image/png;base64,')" />
> </fo:block>
> </fo:flow>
> </fo:page-sequence>
> </fo:root>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)