On 21 Apr 2009, at 15:50, Al Dancer wrote:

Hi Al

www-slave:root>javac ExampleFO2PDF.java
ExampleFO2PDF.java:68: unreported exception org.xml.sax.SAXException; must be caught or declared to be thrown fopFactory.setUserConfig(new File("/opt/coolstack/fop/conf/ fop.xconf"));
                                ^
<snip />
That's weird, the compile was successfull if only I move this line into the
try { } as following:

----------------
public void convertFO2PDF(File fo, File pdf) throws IOException, FOPException { //fopFactory.setUserConfig(new File("/opt/coolstack/fop/conf/ fop.xconf"));
        OutputStream out = null;
        try {
fopFactory.setUserConfig(new File("/opt/coolstack/fop/conf/ fop.xconf"));

That's normal, and basic Java. FopFactory.setUserConfig() can throw a checked SAXException, which means you either have to add it to the 'throws' clause to the method signature, or you need to try-catch it explicitly.

Make it:
convertFO2PDF(...) throws IOException, SAXException {

Replacing FOPException with SAXException is sufficient, since a FOPException is itself a SAXException.

HTH!

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to