diff options
author | fotis <fotis@unknown> | 2000-11-23 21:17:47 +0000 |
---|---|---|
committer | fotis <fotis@unknown> | 2000-11-23 21:17:47 +0000 |
commit | ad2eca3f82e6be951f2786e88abf4fc99d400fc4 (patch) | |
tree | 9353e96ff30a1a926f5050c8df9a25b4bfa3ca6b | |
parent | 3565fa8a67811f39a406429209979bb885db2ffd (diff) | |
download | xmlgraphics-fop-ad2eca3f82e6be951f2786e88abf4fc99d400fc4.tar.gz xmlgraphics-fop-ad2eca3f82e6be951f2786e88abf4fc99d400fc4.zip |
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
-rw-r--r-- | src/org/apache/fop/apps/XalanCommandLine.java | 6 |
1 files changed, 5 insertions, 1 deletions
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()); |