Andreas L. Delmelle wrote:

From: Agar, Robert [mailto:[EMAIL PROTECTED]
>>
I have FOP running embedded in a java program. How do I make it
throw an exception on an error, rather than just logging it?

AFAICT no additional Exception is thrown, most likely because an image not being found can hardly be considered a 'fatal' error --rendering can continue, just leaving out the offending fo:external-graphic element-- and the XSL-FO Rec prescribes nothing in particular for dealing with an invalid 'src' attribute, but it seems feasible enough to modify the code so that when the MalformedURLException or FopImageException is caught, it throws a FOPException --which, IIUC, should be enough to send the signal to break off any further processing--, and when you catch that Exception in your app, you can then provide the necessary error-handling code for it.

You dont need to modify the FOP code to catch this error. The best way to do it is to write a class that implements the org.apache.fop.messaging.MessageListener interface. The processMessage method can easily identify messages of type ERROR and throw an exception to halt the user's application.


Once youve written a class to handle messages you will need call:

MessageHandler.setScreenLogger(logger);
m_fopDriver.setLogger(logger);

Chris


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to