From fc466abd9704dd97881d8650495e23eb947307fe Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 27 Apr 2006 07:33:19 +0000 Subject: [PATCH] Bugzilla #39416: JDK 1.3 compatibility. Added missing serializer*.jar to the classpath. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@397466 13f79535-47bb-0310-9956-ffa450edef68 --- examples/embedding/build.xml | 1 + examples/embedding/java/embedding/MultipleFO2PDF.java | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/embedding/build.xml b/examples/embedding/build.xml index fc9c84baa..6861429ba 100644 --- a/examples/embedding/build.xml +++ b/examples/embedding/build.xml @@ -37,6 +37,7 @@ + diff --git a/examples/embedding/java/embedding/MultipleFO2PDF.java b/examples/embedding/java/embedding/MultipleFO2PDF.java index eccdba46b..6a0e1146d 100644 --- a/examples/embedding/java/embedding/MultipleFO2PDF.java +++ b/examples/embedding/java/embedding/MultipleFO2PDF.java @@ -36,6 +36,7 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.transform.sax.SAXResult; // FOP +import org.apache.commons.io.IOUtils; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FOPException; @@ -97,7 +98,7 @@ public class MultipleFO2PDF { // Start XSLT transformation and FOP processing transformer.transform(src, res); } finally { - out.close(); + IOUtils.closeQuietly(out); } return fop.getResults(); @@ -131,7 +132,8 @@ public class MultipleFO2PDF { } File fofile = new File(baseDir, foname); String pdfname = foname; - pdfname.replaceFirst("\\.fo", ".pdf"); + int p = foname.lastIndexOf('.'); + pdfname = foname.substring(0, p) + ".pdf"; File pdffile = new File(outDir, pdfname); // transform and render -- 2.39.5