diff options
Diffstat (limited to 'xmerge')
-rw-r--r-- | xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java index 7e970334d9b2..9d3ae7cb00a7 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java @@ -100,6 +100,15 @@ public final class Driver { } } + private static void close(FileOutputStream c) { + if (c == null) return; + try { + c.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + /** * Gets a {@code Convert} object using the {@code ConverterFactory} and does * the conversion using this object. @@ -153,15 +162,17 @@ public final class Driver { while (docEnum.hasNext()) { Document docOut = (Document)docEnum.next(); String fileName = docOut.getFileName(); + FileOutputStream fos = null; try { - FileOutputStream fos = new FileOutputStream(fileName); + fos = new FileOutputStream(fileName); docOut.write(fos); fos.flush(); - fos.close(); } catch (Exception writeExcept) { System.out.println("\nThere was an writing out file <" + fileName + ">"); writeExcept.printStackTrace(); + } finally { + close(fos); } } } else { |