aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2023-11-15 10:22:49 +0000
committerDominik Stadler <centic@apache.org>2023-11-15 10:22:49 +0000
commit219954c07c1f2569d8a1ccf68bc59f268f37d1ae (patch)
treeab5f3fdad29a5eca9a943744abc6f84047e482d3
parent3b03ed58e4f455ef678847c075fdcb93d5e393c4 (diff)
downloadpoi-219954c07c1f2569d8a1ccf68bc59f268f37d1ae.tar.gz
poi-219954c07c1f2569d8a1ccf68bc59f268f37d1ae.zip
Close document always in SlideShowRecordDumper
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913795 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowRecordDumper.java12
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSlideShowRecordDumper.java2
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(),
});