aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/ddf
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2016-03-21 00:14:21 +0000
committerAndreas Beeker <kiwiwings@apache.org>2016-03-21 00:14:21 +0000
commitfe653de0e656256db8bcbef399116d598355b5bc (patch)
tree2b934b78fea768a14dcc54e537260e89f5aebaf6 /src/testcases/org/apache/poi/ddf
parente826364ac22efb471eb0f720040a438cabf00027 (diff)
downloadpoi-fe653de0e656256db8bcbef399116d598355b5bc.tar.gz
poi-fe653de0e656256db8bcbef399116d598355b5bc.zip
fix eclipse warnings
close resources git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1735912 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ddf')
-rw-r--r--src/testcases/org/apache/poi/ddf/TestEscherDump.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/testcases/org/apache/poi/ddf/TestEscherDump.java b/src/testcases/org/apache/poi/ddf/TestEscherDump.java
index 992eb5e1bd..9b72d9acd2 100644
--- a/src/testcases/org/apache/poi/ddf/TestEscherDump.java
+++ b/src/testcases/org/apache/poi/ddf/TestEscherDump.java
@@ -30,29 +30,37 @@ import org.apache.poi.POIDataSamples;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LocaleUtil;
+import org.junit.BeforeClass;
import org.junit.Test;
public class TestEscherDump {
+ static NullPrinterStream nullPS;
+
+ @BeforeClass
+ public static void init() throws UnsupportedEncodingException {
+ nullPS = new NullPrinterStream();
+ }
+
@Test
public void testSimple() throws Exception {
// simple test to at least cover some parts of the class
- EscherDump.main(new String[] {}, new NullPrinterStream());
+ EscherDump.main(new String[] {}, nullPS);
- new EscherDump().dump(0, new byte[] {}, new NullPrinterStream());
- new EscherDump().dump(new byte[] {}, 0, 0, new NullPrinterStream());
- new EscherDump().dumpOld(0, new ByteArrayInputStream(new byte[] {}), new NullPrinterStream());
+ new EscherDump().dump(0, new byte[] {}, nullPS);
+ new EscherDump().dump(new byte[] {}, 0, 0, nullPS);
+ new EscherDump().dumpOld(0, new ByteArrayInputStream(new byte[] {}), nullPS);
}
@Test
public void testWithData() throws Exception {
- new EscherDump().dumpOld(8, new ByteArrayInputStream(new byte[] { 00, 00, 00, 00, 00, 00, 00, 00 }), new NullPrinterStream());
+ new EscherDump().dumpOld(8, new ByteArrayInputStream(new byte[] { 00, 00, 00, 00, 00, 00, 00, 00 }), nullPS);
}
@Test
public void testWithSamplefile() throws Exception {
//InputStream stream = HSSFTestDataSamples.openSampleFileStream(")
byte[] data = POIDataSamples.getDDFInstance().readFile("Container.dat");
- new EscherDump().dump(data.length, data, new NullPrinterStream());
+ new EscherDump().dump(data.length, data, nullPS);
//new EscherDump().dumpOld(data.length, new ByteArrayInputStream(data), System.out);
data = new byte[2586114];
@@ -72,6 +80,7 @@ public class TestEscherDump {
* to redirect stdout to avoid spamming the console with output
*/
private static class NullPrinterStream extends PrintStream {
+ @SuppressWarnings("resource")
private NullPrinterStream() throws UnsupportedEncodingException {
super(new NullOutputStream(),true,LocaleUtil.CHARSET_1252.name());
}