While Ivan's reply is correct, it is really a bit quick and dirty.
For less experienced Java programmers a slightly fuller explanations is:
Any method in Java can choose to throw an exception if something goes
wrong. The caller of that function must be prepared to handle any
exceptions that may be thrown and then do whatever they think is most
appropriate. What Ivan's sample code does is catch any exception (
remember all exceptions extend the class java.lang.Exception) and ignore
the error. 'Swallowing' exceptions in his way is generally a bad practice
as when something goes wrong, you never find out about it. The minimum you
should do is either: rethrow the exception to your caller or print a stack
trace.
Very often you will want to handle different types of exceptions in a
special way and so should catch org.apache.fop.apps.FOPException for
example.
Trev
"IvanLatysh"
<ivan@yourmail To: <[EMAIL PROTECTED]>
.com> cc:
Subject: Re: FOP exception
11/12/2001
08:32 AM
Please respond
to fop-dev
Hello, SHU!
You wrote to <[EMAIL PROTECTED]> on Mon, 10 Dec 2001 12:21 -0800:
Put all this code in try block.
Like this
try{
File xmlf = new File("c:/jdk1.3.1/xslfoRef.xml");
File xslf = new File("c:/jdk1.3.1/xml2pdf.xsl");
File writefile = new File("shu.pdf");
Driver driver = new Driver();
driver.setRenderer(Driver.RENDER_PDF);
InputHandler inputHandler = new XSLTInputHandler(xmlf, xslf);
XMLReader parser = inputHandler.getParser();
InputSource inputSource = inputHandler.getInputSource();
driver.setOutputStream(new FileOutputStream("shu.pdf"));
driver.render(parser, inputSource);
//outfile.close();
} catch (Exception ex) {
}
---
Yours sincerely, Ivan Latysh.
[EMAIL PROTECTED]
http://ivan.yourmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]