Hello,
I am trying to include the FOP-Framework into a Java-Environment and to start the
conversion inline. But the System.exit exits the whole application. Is there a way to
have a java Program starting FOP-Konversion not from the CommandLine?
in the class org.apache.fop.apps.CommandLineStarter there is a
System.exit(0)
in the run-method, why ?
Is it a problem to add a FileOutputStream and to close the stream in the finally
method instead of using the exit?
Thanks for help
Juergen Lippold
public void run() throws FOPException {
String version = Version.getVersion();
log.info(version);
XMLReader parser = inputHandler.getParser();
setParserFeatures(parser);
Driver driver = new Driver();
driver.setLogger(log);
driver.setBufferFile(commandLineOptions.getBufferFile());
if (errorDump) {
driver.setErrorDump(true);
}
FileOutputStream fos = null;
try {
driver.setRenderer(commandLineOptions.getRenderer());
//driver.setOutputStream( new FileOutputStream(
// commandLineOptions.getOutputFile()));
fos = new FileOutputStream(commandLineOptions.getOutputFile());
driver.setOutputStream(fos);
driver.getRenderer().setOptions(
commandLineOptions.getRendererOptions());
driver.render(parser, inputHandler.getInputSource());
//
//System.exit(0); Do not stop here in the finally part the file will be
closed
//
} catch (Exception e) {
if (e instanceof FOPException) {
throw (FOPException) e;
}
throw new FOPException(e);
}
finally {
try {
if (fos != null) fos.close(); // closing the stream
}
catch (IOException e) {
throw new FOPException(e);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]