diff options
Diffstat (limited to 'src/org/apache/fop/apps/CommandLineStarter.java')
-rw-r--r-- | src/org/apache/fop/apps/CommandLineStarter.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/org/apache/fop/apps/CommandLineStarter.java b/src/org/apache/fop/apps/CommandLineStarter.java index 744d54005..befa7010a 100644 --- a/src/org/apache/fop/apps/CommandLineStarter.java +++ b/src/org/apache/fop/apps/CommandLineStarter.java @@ -50,13 +50,16 @@ public class CommandLineStarter extends Starter { driver.setRenderer(commandLineOptions.getRenderer()); BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream( commandLineOptions.getOutputFile())); - driver.setOutputStream(bos); - if (driver.getRenderer() != null) { - driver.getRenderer().setOptions( - commandLineOptions.getRendererOptions()); + try { + driver.setOutputStream(bos); + if (driver.getRenderer() != null) { + driver.getRenderer().setOptions( + commandLineOptions.getRendererOptions()); + } + driver.render(parser, inputHandler.getInputSource()); + } finally { + bos.close(); } - driver.render(parser, inputHandler.getInputSource()); - bos.close(); System.exit(0); } catch (Exception e) { if (e instanceof FOPException) { |