From 219954c07c1f2569d8a1ccf68bc59f268f37d1ae Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Wed, 15 Nov 2023 10:22:49 +0000 Subject: [PATCH] Close document always in SlideShowRecordDumper git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913795 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/hslf/dev/SlideShowRecordDumper.java | 12 ++++++------ .../poi/hslf/dev/TestSlideShowRecordDumper.java | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowRecordDumper.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowRecordDumper.java index 005da13472..c7cecd8b37 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowRecordDumper.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowRecordDumper.java @@ -79,12 +79,12 @@ public final class SlideShowRecordDumper { String filename = args[ndx]; - SlideShowRecordDumper foo = new SlideShowRecordDumper(System.out, - filename, verbose, escher); - - foo.printDump(); - - foo.doc.close(); + SlideShowRecordDumper foo = new SlideShowRecordDumper(System.out, filename, verbose, escher); + try { + foo.printDump(); + } finally { + foo.doc.close(); + } } public static void printUsage() { diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSlideShowRecordDumper.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSlideShowRecordDumper.java index 2a45921a11..73bbd376fd 100644 --- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSlideShowRecordDumper.java +++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSlideShowRecordDumper.java @@ -35,6 +35,8 @@ public class TestSlideShowRecordDumper extends BaseTestPPTIterating { @Test void testMain() throws IOException { + SlideShowRecordDumper.main(new String[] {}); + SlideShowRecordDumper.main(new String[] { HSLFTestDataSamples.getSampleFile("slide_master.ppt").getAbsolutePath(), }); -- 2.39.5