]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
fix: closes pdf file explicitly. Reason: while generating PDFs in batch mode(with...
authorfotis <fotis@unknown>
Thu, 23 Nov 2000 21:17:47 +0000 (21:17 +0000)
committerfotis <fotis@unknown>
Thu, 23 Nov 2000 21:17:47 +0000 (21:17 +0000)
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

src/org/apache/fop/apps/XalanCommandLine.java

index 0981dfe7e76dc12e519015c10c0b817598d8b837..a82c418590a628f54291fa86048c189e42856c80 100644 (file)
@@ -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());