From: fotis Date: Thu, 23 Nov 2000 21:17:47 +0000 (+0000) Subject: fix: closes pdf file explicitly. Reason: while generating PDFs in batch mode(with... X-Git-Tag: pre-columns~55 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ad2eca3f82e6be951f2786e88abf4fc99d400fc4;p=xmlgraphics-fop.git fix: closes pdf file explicitly. Reason: while generating PDFs in batch mode(with same PDF output filename), the PDF file is sometimes not writable for subsequent generation [Dharamveer Salecha] git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193831 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/apps/XalanCommandLine.java b/src/org/apache/fop/apps/XalanCommandLine.java index 0981dfe7e..a82c41859 100644 --- a/src/org/apache/fop/apps/XalanCommandLine.java +++ b/src/org/apache/fop/apps/XalanCommandLine.java @@ -66,6 +66,7 @@ import java.io.StringWriter; import java.io.StringReader; import java.io.FileWriter; import java.io.PrintWriter; +import java.io.BufferedWriter; import java.io.IOException; import java.io.FileNotFoundException; import java.net.URL; @@ -244,7 +245,8 @@ public class XalanCommandLine { driver.addElementMapping("org.apache.fop.svg.SVGElementMapping"); driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping"); driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping"); - driver.setWriter(new PrintWriter(new FileWriter(args[2]))); + PrintWriter pwriter = new PrintWriter(new BufferedWriter(new FileWriter(args[2]))); + driver.setWriter(pwriter); driver.buildFOTree(parser, new InputSource(reader)); reader.close(); driver.format(); @@ -252,6 +254,8 @@ public class XalanCommandLine { if (usefile) { new File (args[2] + ".tmp").delete(); } + pwriter.flush(); + pwriter.close(); } catch (Exception e) { MessageHandler.errorln("FATAL ERROR: " + e.getMessage());