You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2003/01/27 10:25:19 UTC

cvs commit: xml-fop/src/org/apache/fop/apps CommandLineStarter.java

jeremias    2003/01/27 01:25:19

  Modified:    src/org/apache/fop/apps CommandLineStarter.java
  Log:
  Make sure OutputStream gets closed in case of an Exception
  
  Revision  Changes    Path
  1.21      +10 -7     xml-fop/src/org/apache/fop/apps/CommandLineStarter.java
  
  Index: CommandLineStarter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/CommandLineStarter.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- CommandLineStarter.java	13 Jan 2003 21:05:12 -0000	1.20
  +++ CommandLineStarter.java	27 Jan 2003 09:25:19 -0000	1.21
  @@ -50,13 +50,16 @@
               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) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org