You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2016/10/25 10:24:48 UTC
svn commit: r1766503 -
/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java
Author: nick
Date: Tue Oct 25 10:24:48 2016
New Revision: 1766503
URL: http://svn.apache.org/viewvc?rev=1766503&view=rev
Log:
Fix close warnings
Modified:
poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java?rev=1766503&r1=1766502&r2=1766503&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java Tue Oct 25 10:24:48 2016
@@ -29,19 +29,26 @@ public final class TestHDGFCore extends
private static POIDataSamples _dgTests = POIDataSamples.getDiagramInstance();
private POIFSFileSystem fs;
+ private HDGFDiagram hdgf;
+ private VisioTextExtractor textExtractor;
@Override
protected void setUp() throws Exception {
fs = new POIFSFileSystem(_dgTests.openResourceAsStream("Test_Visio-Some_Random_Text.vsd"));
}
-
+ @Override
+ protected void tearDown() throws Exception {
+ if (textExtractor != null) textExtractor.close();
+ if (hdgf != null) hdgf.close();
+ }
+
public void testCreate() throws Exception {
- new HDGFDiagram(fs);
+ hdgf = new HDGFDiagram(fs);
}
public void testTrailer() throws Exception {
- HDGFDiagram hdgf = new HDGFDiagram(fs);
+ hdgf = new HDGFDiagram(fs);
assertNotNull(hdgf);
assertNotNull(hdgf.getTrailerStream());
@@ -70,7 +77,7 @@ public final class TestHDGFCore extends
public void testNegativeChunkLength() throws Exception {
fs = new POIFSFileSystem(_dgTests.openResourceAsStream("NegativeChunkLength.vsd"));
- HDGFDiagram hdgf = new HDGFDiagram(fs);
+ hdgf = new HDGFDiagram(fs);
assertNotNull(hdgf);
// And another file
@@ -88,17 +95,17 @@ public final class TestHDGFCore extends
public void DISABLEDtestAIOOB() throws Exception {
fs = new POIFSFileSystem(_dgTests.openResourceAsStream("44501.vsd"));
- HDGFDiagram hdgf = new HDGFDiagram(fs);
+ hdgf = new HDGFDiagram(fs);
assertNotNull(hdgf);
}
public void testV5() throws Exception {
fs = new POIFSFileSystem(_dgTests.openResourceAsStream("v5_Connection_Types.vsd"));
- HDGFDiagram hdgf = new HDGFDiagram(fs);
+ hdgf = new HDGFDiagram(fs);
assertNotNull(hdgf);
- VisioTextExtractor textExtractor = new VisioTextExtractor(hdgf);
+ textExtractor = new VisioTextExtractor(hdgf);
String text = textExtractor.getText().replace("\u0000", "").trim();
assertEquals("Static to Static\nDynamic to Static\nDynamic to Dynamic", text);
@@ -107,10 +114,10 @@ public final class TestHDGFCore extends
public void testV6NonUtf16LE() throws Exception {
fs = new POIFSFileSystem(_dgTests.openResourceAsStream("v6-non-utf16le.vsd"));
- HDGFDiagram hdgf = new HDGFDiagram(fs);
+ hdgf = new HDGFDiagram(fs);
assertNotNull(hdgf);
- VisioTextExtractor textExtractor = new VisioTextExtractor(hdgf);
+ textExtractor = new VisioTextExtractor(hdgf);
String text = textExtractor.getText().replace("\u0000", "").trim();
assertEquals("Table\n\n\nPropertySheet\n\n\n\nPropertySheetField", text);
@@ -119,10 +126,10 @@ public final class TestHDGFCore extends
public void testUtf16LE() throws Exception {
fs = new POIFSFileSystem(_dgTests.openResourceAsStream("Test_Visio-Some_Random_Text.vsd"));
- HDGFDiagram hdgf = new HDGFDiagram(fs);
+ hdgf = new HDGFDiagram(fs);
assertNotNull(hdgf);
- VisioTextExtractor textExtractor = new VisioTextExtractor(hdgf);
+ textExtractor = new VisioTextExtractor(hdgf);
String text = textExtractor.getText().trim();
assertEquals("text\nView\nTest View\nI am a test view\nSome random text, on a page", text);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org