sonarqube fixes - close resources

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1774845 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
kiwiwings 2016-12-18 03:47:08 +00:00
parent c4b37f0723
commit 4f94969a41
5 changed files with 24 additions and 5 deletions

View File

@ -17,6 +17,8 @@
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import java.io.IOException;
import org.apache.poi.hslf.record.EscherTextboxWrapper; import org.apache.poi.hslf.record.EscherTextboxWrapper;
import org.apache.poi.hslf.record.PPDrawing; import org.apache.poi.hslf.record.PPDrawing;
import org.apache.poi.hslf.record.Record; 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 * searches those for text. Prints out any text it finds
*/ */
public final class PPDrawingTextListing { public final class PPDrawingTextListing {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws IOException {
if(args.length < 1) { if(args.length < 1) {
System.err.println("Need to give a filename"); System.err.println("Need to give a filename");
System.exit(1); System.exit(1);
@ -81,5 +83,7 @@ public final class PPDrawingTextListing {
} }
} }
} }
ss.close();
} }
} }

View File

@ -17,6 +17,8 @@
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import java.io.IOException;
import org.apache.poi.hslf.record.Document; import org.apache.poi.hslf.record.Document;
import org.apache.poi.hslf.record.Record; import org.apache.poi.hslf.record.Record;
import org.apache.poi.hslf.record.RecordTypes; 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 * and reports how many, and what sorts of things they contain
*/ */
public final class SLWTListing { public final class SLWTListing {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws IOException {
if(args.length < 1) { if(args.length < 1) {
System.err.println("Need to give a filename"); System.err.println("Need to give a filename");
System.exit(1); System.exit(1);
@ -85,5 +87,7 @@ public final class SLWTListing {
} }
} }
} }
ss.close();
} }
} }

View File

@ -17,6 +17,8 @@
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import java.io.IOException;
import org.apache.poi.hslf.record.Document; import org.apache.poi.hslf.record.Document;
import org.apache.poi.hslf.record.Record; import org.apache.poi.hslf.record.Record;
import org.apache.poi.hslf.record.SlideListWithText; import org.apache.poi.hslf.record.SlideListWithText;
@ -31,7 +33,7 @@ import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
* what it finds. * what it finds.
*/ */
public final class SLWTTextListing { public final class SLWTTextListing {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws IOException {
if(args.length < 1) { if(args.length < 1) {
System.err.println("Need to give a filename"); System.err.println("Need to give a filename");
System.exit(1); System.exit(1);
@ -86,5 +88,7 @@ public final class SLWTTextListing {
} }
} }
} }
ss.close();
} }
} }

View File

@ -17,6 +17,8 @@
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import java.io.IOException;
import org.apache.poi.hslf.record.Notes; import org.apache.poi.hslf.record.Notes;
import org.apache.poi.hslf.record.NotesAtom; import org.apache.poi.hslf.record.NotesAtom;
import org.apache.poi.hslf.record.Record; import org.apache.poi.hslf.record.Record;
@ -32,7 +34,7 @@ import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
* Slides, Master Slides and Notes * Slides, Master Slides and Notes
*/ */
public final class SlideAndNotesAtomListing { public final class SlideAndNotesAtomListing {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws IOException {
if(args.length < 1) { if(args.length < 1) {
System.err.println("Need to give a filename"); System.err.println("Need to give a filename");
System.exit(1); System.exit(1);
@ -63,5 +65,7 @@ public final class SlideAndNotesAtomListing {
System.out.println(""); System.out.println("");
} }
} }
ss.close();
} }
} }

View File

@ -18,6 +18,7 @@
package org.apache.poi.hslf.dev; package org.apache.poi.hslf.dev;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Map; import java.util.Map;
import org.apache.poi.hslf.record.Document; import org.apache.poi.hslf.record.Document;
@ -42,7 +43,7 @@ import org.apache.poi.util.LittleEndian;
public final class SlideIdListing { public final class SlideIdListing {
private static byte[] fileContents; private static byte[] fileContents;
public static void main(String[] args) throws Exception { public static void main(String[] args) throws IOException {
if(args.length < 1) { if(args.length < 1) {
System.err.println("Need to give a filename"); System.err.println("Need to give a filename");
System.exit(1); System.exit(1);
@ -154,6 +155,8 @@ public final class SlideIdListing {
pos += baos.size(); pos += baos.size();
} }
ss.close();
System.out.println(""); System.out.println("");
} }