From 4f94969a4105a9b4d65aea408e707c1fe903cde0 Mon Sep 17 00:00:00 2001 From: kiwiwings Date: Sun, 18 Dec 2016 03:47:08 +0000 Subject: [PATCH] sonarqube fixes - close resources git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1774845 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hslf/dev/PPDrawingTextListing.java | 6 +++++- src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java | 6 +++++- .../src/org/apache/poi/hslf/dev/SLWTTextListing.java | 6 +++++- .../org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java | 6 +++++- .../src/org/apache/poi/hslf/dev/SlideIdListing.java | 5 ++++- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java b/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java index af05efa7d..380f9003b 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java +++ b/src/scratchpad/src/org/apache/poi/hslf/dev/PPDrawingTextListing.java @@ -17,6 +17,8 @@ package org.apache.poi.hslf.dev; +import java.io.IOException; + import org.apache.poi.hslf.record.EscherTextboxWrapper; import org.apache.poi.hslf.record.PPDrawing; import org.apache.poi.hslf.record.Record; @@ -31,7 +33,7 @@ import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; * searches those for text. Prints out any text it finds */ public final class PPDrawingTextListing { - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException { if(args.length < 1) { System.err.println("Need to give a filename"); System.exit(1); @@ -81,5 +83,7 @@ public final class PPDrawingTextListing { } } } + + ss.close(); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java b/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java index 90f404b1e..ff42ce0a4 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java +++ b/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTListing.java @@ -17,6 +17,8 @@ package org.apache.poi.hslf.dev; +import java.io.IOException; + import org.apache.poi.hslf.record.Document; import org.apache.poi.hslf.record.Record; import org.apache.poi.hslf.record.RecordTypes; @@ -29,7 +31,7 @@ import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; * and reports how many, and what sorts of things they contain */ public final class SLWTListing { - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException { if(args.length < 1) { System.err.println("Need to give a filename"); System.exit(1); @@ -85,5 +87,7 @@ public final class SLWTListing { } } } + + ss.close(); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java b/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java index 5ef595658..bb53698f7 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java +++ b/src/scratchpad/src/org/apache/poi/hslf/dev/SLWTTextListing.java @@ -17,6 +17,8 @@ package org.apache.poi.hslf.dev; +import java.io.IOException; + import org.apache.poi.hslf.record.Document; import org.apache.poi.hslf.record.Record; import org.apache.poi.hslf.record.SlideListWithText; @@ -31,7 +33,7 @@ import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; * what it finds. */ public final class SLWTTextListing { - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException { if(args.length < 1) { System.err.println("Need to give a filename"); System.exit(1); @@ -86,5 +88,7 @@ public final class SLWTTextListing { } } } + + ss.close(); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java b/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java index bc571008e..711f4ad6f 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java +++ b/src/scratchpad/src/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java @@ -17,6 +17,8 @@ package org.apache.poi.hslf.dev; +import java.io.IOException; + import org.apache.poi.hslf.record.Notes; import org.apache.poi.hslf.record.NotesAtom; import org.apache.poi.hslf.record.Record; @@ -32,7 +34,7 @@ import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; * Slides, Master Slides and Notes */ public final class SlideAndNotesAtomListing { - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException { if(args.length < 1) { System.err.println("Need to give a filename"); System.exit(1); @@ -63,5 +65,7 @@ public final class SlideAndNotesAtomListing { System.out.println(""); } } + + ss.close(); } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java b/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java index 1398175f4..b492f4bda 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java +++ b/src/scratchpad/src/org/apache/poi/hslf/dev/SlideIdListing.java @@ -18,6 +18,7 @@ package org.apache.poi.hslf.dev; import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.util.Map; import org.apache.poi.hslf.record.Document; @@ -42,7 +43,7 @@ import org.apache.poi.util.LittleEndian; public final class SlideIdListing { private static byte[] fileContents; - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException { if(args.length < 1) { System.err.println("Need to give a filename"); System.exit(1); @@ -154,6 +155,8 @@ public final class SlideIdListing { pos += baos.size(); } + ss.close(); + System.out.println(""); }