poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1797043 [1/2] - in /poi/trunk/src: ooxml/testcases/org/apache/poi/xslf/usermodel/ ooxml/testcases/org/apache/poi/xssf/usermodel/ ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/ scratchpad/src/org/apache/poi/extractor/ scratchpad/src...
Date Wed, 31 May 2017 14:10:18 GMT
Author: kiwiwings
Date: Wed May 31 14:10:18 2017
New Revision: 1797043

URL: http://svn.apache.org/viewvc?rev=1797043&view=rev
Log:
fix eclipse resource leak warnings

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFShapeContainer.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDialogSheet.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java
    poi/trunk/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestLine.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPFont.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestFontRendering.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList2.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestHWPFOldDocument.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestNonStandardWorkbookStreamNames.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestShapeGroup.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestSubtotal.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java Wed May 31 14:10:18 2017
@@ -18,12 +18,11 @@
  */
 package org.apache.poi.xslf.usermodel;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-import junit.framework.TestCase;
-
 import org.apache.poi.POIXMLDocumentPart;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellReference;
@@ -31,17 +30,26 @@ import org.apache.poi.xslf.XSLFTestDataS
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.openxmlformats.schemas.drawingml.x2006.chart.*;
+import org.junit.Test;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTChart;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumData;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumVal;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTPieChart;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTPieSer;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrData;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrVal;
 
-/**
- * @author Yegor Kozlov
- */
-public class TestXSLFChart extends TestCase {
+public class TestXSLFChart {
 
     /**
      * a modified version from POI-examples
      */
-    public void testFillChartTemplate() throws Exception {
+    @Test
+    public void testFillChartTemplate() throws IOException {
 
         String chartTitle = "Apache POI";  // first line is chart title
 
@@ -126,7 +134,7 @@ public class TestXSLFChart extends TestC
         OutputStream xlsOut = xlsPart.getPackagePart().getOutputStream();
         wb.write(xlsOut);
         xlsOut.close();
-
+        wb.close();
     }
 
 }
\ No newline at end of file

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFShapeContainer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFShapeContainer.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFShapeContainer.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFShapeContainer.java Wed May 31 14:10:18 2017
@@ -18,32 +18,31 @@
  */
 package org.apache.poi.xslf.usermodel;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
 
 import org.junit.Test;
 
 /**
  * test common operations on containers of shapes (sheets and groups of shapes)
- *
- * @author Yegor Kozlov
  */
 public class TestXSLFShapeContainer {
 
-    @SuppressWarnings("unused")
     public void verifyContainer(XSLFShapeContainer container) {
         container.clear();
         assertEquals(0, container.getShapes().size());
 
-        XSLFGroupShape shape1 = container.createGroup();
+        container.createGroup();
         assertEquals(1, container.getShapes().size());
 
-        XSLFTextBox shape2 = container.createTextBox();
+        container.createTextBox();
         assertEquals(2, container.getShapes().size());
 
-        XSLFAutoShape shape3 = container.createAutoShape();
+        container.createAutoShape();
         assertEquals(3, container.getShapes().size());
 
-        XSLFConnectorShape shape4 = container.createConnector();
+        container.createConnector();
         assertEquals(4, container.getShapes().size());
 
         container.clear();
@@ -51,7 +50,7 @@ public class TestXSLFShapeContainer {
     }
 
     @Test
-    public void testSheet() {
+    public void testSheet() throws IOException {
         XMLSlideShow ppt = new XMLSlideShow();
         XSLFSheet sheet = ppt.createSlide();
         verifyContainer(sheet);
@@ -60,5 +59,6 @@ public class TestXSLFShapeContainer {
         XSLFGroupShape group = sheet.createGroup();
         verifyContainer(group);
 
+        ppt.close();
     }
 }
\ No newline at end of file

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDialogSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDialogSheet.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDialogSheet.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDialogSheet.java Wed May 31 14:10:18 2017
@@ -17,46 +17,60 @@
 
 package org.apache.poi.xssf.usermodel;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
 
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
+import org.junit.Test;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDialogsheet;
 
 
-public class TestXSSFDialogSheet extends TestCase {
-	
+public class TestXSSFDialogSheet {
 
-	public void testCreateDialogSheet() {
+    @Test
+	public void testCreateDialogSheet() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         Sheet dialogsheet = workbook.createDialogsheet("Dialogsheet 1", CTDialogsheet.Factory.newInstance());
         assertNotNull(dialogsheet);
+        workbook.close();
 	}
-    
-    public void testGetDialog() {
+
+    @Test
+    public void testGetDialog() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet dialogsheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertTrue(dialogsheet.getDialog());
-    	
+        workbook.close();
     }
-	
-	public void testAddRow() {
+
+    @Test
+	public void testAddRow() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         Sheet dialogsheet = workbook.createDialogsheet("Dialogsheet 1", CTDialogsheet.Factory.newInstance());
         assertNotNull(dialogsheet);
         Row row = dialogsheet.createRow(0);
         assertNull(row);
+        workbook.close();
 	}
-    
-    public void testGetSetAutoBreaks() {
+
+    @Test
+    public void testGetSetAutoBreaks() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet sheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertTrue(sheet.getAutobreaks());
         sheet.setAutobreaks(false);
         assertFalse(sheet.getAutobreaks());
+        workbook.close();
     }
-    
-    public void testIsSetFitToPage() {
+
+    @Test
+    public void testIsSetFitToPage() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet sheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertFalse(sheet.getFitToPage());
@@ -64,18 +78,22 @@ public class TestXSSFDialogSheet extends
         assertTrue(sheet.getFitToPage());
         sheet.setFitToPage(false);
         assertFalse(sheet.getFitToPage());
+        workbook.close();
     }
-    
-   
-    public void testGetFooter() {
+
+
+    @Test
+    public void testGetFooter() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet sheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertNotNull(sheet.getFooter());
         sheet.getFooter().setCenter("test center footer");
         assertEquals("test center footer", sheet.getFooter().getCenter());
+        workbook.close();
     }
-    
-    public void testGetAllHeadersFooters() {
+
+    @Test
+    public void testGetAllHeadersFooters() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet sheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertNotNull(sheet);
@@ -85,34 +103,35 @@ public class TestXSSFDialogSheet extends
         assertNotNull(sheet.getOddHeader());
         assertNotNull(sheet.getEvenHeader());
         assertNotNull(sheet.getFirstHeader());
-        
+
         assertEquals("", sheet.getOddFooter().getLeft());
         sheet.getOddFooter().setLeft("odd footer left");
         assertEquals("odd footer left", sheet.getOddFooter().getLeft());
-        
+
         assertEquals("", sheet.getEvenFooter().getLeft());
         sheet.getEvenFooter().setLeft("even footer left");
         assertEquals("even footer left", sheet.getEvenFooter().getLeft());
-        
+
         assertEquals("", sheet.getFirstFooter().getLeft());
         sheet.getFirstFooter().setLeft("first footer left");
         assertEquals("first footer left", sheet.getFirstFooter().getLeft());
-        
+
         assertEquals("", sheet.getOddHeader().getLeft());
         sheet.getOddHeader().setLeft("odd header left");
         assertEquals("odd header left", sheet.getOddHeader().getLeft());
-        
+
         assertEquals("", sheet.getOddHeader().getRight());
         sheet.getOddHeader().setRight("odd header right");
         assertEquals("odd header right", sheet.getOddHeader().getRight());
-        
+
         assertEquals("", sheet.getOddHeader().getCenter());
         sheet.getOddHeader().setCenter("odd header center");
         assertEquals("odd header center", sheet.getOddHeader().getCenter());
-
+        workbook.close();
     }
-    
-    public void testGetSetHorizontallyCentered() {
+
+    @Test
+    public void testGetSetHorizontallyCentered() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet sheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertFalse(sheet.getHorizontallyCenter());
@@ -120,9 +139,11 @@ public class TestXSSFDialogSheet extends
         assertTrue(sheet.getHorizontallyCenter());
         sheet.setHorizontallyCenter(false);
         assertFalse(sheet.getHorizontallyCenter());
+        workbook.close();
     }
-    
-    public void testGetSetVerticallyCentered() {
+
+    @Test
+    public void testGetSetVerticallyCentered() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet sheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertFalse(sheet.getVerticallyCenter());
@@ -130,44 +151,55 @@ public class TestXSSFDialogSheet extends
         assertTrue(sheet.getVerticallyCenter());
         sheet.setVerticallyCenter(false);
         assertFalse(sheet.getVerticallyCenter());
+        workbook.close();
     }
-    
-    public void testIsSetPrintGridlines() {
+
+    @Test
+    public void testIsSetPrintGridlines() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet sheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertFalse(sheet.isPrintGridlines());
         sheet.setPrintGridlines(true);
         assertTrue(sheet.isPrintGridlines());
+        workbook.close();
     }
-    
-    public void testIsSetDisplayFormulas() {
+
+    @Test
+    public void testIsSetDisplayFormulas() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet sheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertFalse(sheet.isDisplayFormulas());
         sheet.setDisplayFormulas(true);
         assertTrue(sheet.isDisplayFormulas());
+        workbook.close();
     }
-    
-    public void testIsSetDisplayGridLines() {
+
+    @Test
+    public void testIsSetDisplayGridLines() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet sheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertTrue(sheet.isDisplayGridlines());
         sheet.setDisplayGridlines(false);
         assertFalse(sheet.isDisplayGridlines());
+        workbook.close();
     }
-    
-    public void testIsSetDisplayRowColHeadings() {
+
+    @Test
+    public void testIsSetDisplayRowColHeadings() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet sheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertTrue(sheet.isDisplayRowColHeadings());
         sheet.setDisplayRowColHeadings(false);
         assertFalse(sheet.isDisplayRowColHeadings());
+        workbook.close();
     }
-    
-    public void testGetScenarioProtect() {
+
+    @Test
+    public void testGetScenarioProtect() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFDialogsheet sheet = workbook.createDialogsheet("Dialogsheet 1", null);
         assertFalse(sheet.getScenarioProtect());
+        workbook.close();
     }
-	
+
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java Wed May 31 14:10:18 2017
@@ -23,12 +23,13 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import org.junit.Test;
+import java.io.IOException;
 
 import org.apache.poi.xssf.model.StylesTable;
 import org.apache.poi.xssf.usermodel.XSSFCellStyle;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.junit.Test;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
@@ -329,7 +330,7 @@ public final class TestColumnHelper {
     }
 
     @Test
-    public void testGetOrCreateColumn() {
+    public void testGetOrCreateColumn() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFSheet sheet = workbook.createSheet("Sheet 1");
         ColumnHelper columnHelper = sheet.getColumnHelper();
@@ -348,10 +349,12 @@ public final class TestColumnHelper {
         assertNotNull(columnHelper.getColumn(29, false));
         assertNotNull(columnHelper.getColumn1Based(30, false));
         assertNull(columnHelper.getColumn(30, false));
+
+        workbook.close();
     }
 
     @Test
-    public void testGetSetColDefaultStyle() {
+    public void testGetSetColDefaultStyle() throws IOException {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFSheet sheet = workbook.createSheet();
         CTWorksheet ctWorksheet = sheet.getCTWorksheet();
@@ -382,6 +385,8 @@ public final class TestColumnHelper {
         columnHelper.setColDefaultStyle(11, cellStyle);
         assertEquals(0, col_2.getStyle());
         assertEquals(1, columnHelper.getColDefaultStyle(10));
+        
+        workbook.close();
     }
 
     private static int countColumns(CTWorksheet worksheet) {

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java Wed May 31 14:10:18 2017
@@ -28,6 +28,7 @@ import org.apache.poi.POITextExtractor;
 import org.apache.poi.hdgf.extractor.VisioTextExtractor;
 import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
 import org.apache.poi.hslf.extractor.PowerPointExtractor;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
 import org.apache.poi.hsmf.MAPIMessage;
 import org.apache.poi.hsmf.datatypes.AttachmentChunks;
 import org.apache.poi.hsmf.extractor.OutlookTextExtactor;
@@ -63,7 +64,7 @@ public class OLE2ScratchpadExtractorFact
             }
         }
 
-        if (poifsDir.hasEntry("PowerPoint Document")) {
+        if (poifsDir.hasEntry(HSLFSlideShow.POWERPOINT_DOCUMENT)) {
             return new PowerPointExtractor(poifsDir);
         }
 

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java Wed May 31 14:10:18 2017
@@ -28,6 +28,7 @@ import java.io.Writer;
 import java.nio.charset.Charset;
 
 import org.apache.poi.hslf.record.RecordTypes;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.util.IOUtils;
@@ -40,7 +41,6 @@ import org.apache.poi.util.LittleEndian;
 public final class PPTXMLDump {
     private static final int HEADER_SIZE = 8; //size of the record header
     private static final int PICT_HEADER_SIZE = 25; //size of the picture header
-    private static final String PPDOC_ENTRY = "PowerPoint Document";
     private static final String PICTURES_ENTRY = "Pictures";
     private static final String CR = System.getProperty("line.separator");
 
@@ -52,7 +52,7 @@ public final class PPTXMLDump {
     public PPTXMLDump(File ppt) throws IOException {
         NPOIFSFileSystem fs = new NPOIFSFileSystem(ppt, true);
         try {
-            docstream = readEntry(fs, PPDOC_ENTRY);
+            docstream = readEntry(fs, HSLFSlideShow.POWERPOINT_DOCUMENT);
             pictstream = readEntry(fs, PICTURES_ENTRY);
         } finally {
             fs.close();

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java Wed May 31 14:10:18 2017
@@ -29,6 +29,7 @@ import org.apache.poi.ddf.EscherRecord;
 import org.apache.poi.ddf.EscherTextboxRecord;
 import org.apache.poi.hslf.record.HSLFEscherRecordFactory;
 import org.apache.poi.hslf.record.RecordTypes;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.IOUtils;
@@ -96,7 +97,7 @@ public final class SlideShowDumper {
    */
   public SlideShowDumper(NPOIFSFileSystem filesystem, PrintStream out) throws IOException {
 	// Grab the document stream
-	InputStream is = filesystem.createDocumentInputStream("PowerPoint Document");
+	InputStream is = filesystem.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT);
 	docstream = IOUtils.toByteArray(is);
 	is.close();
 	this.out = out;

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java Wed May 31 14:10:18 2017
@@ -28,6 +28,7 @@ import org.apache.poi.hslf.record.Record
 import org.apache.poi.hslf.record.RecordTypes;
 import org.apache.poi.hslf.record.TextBytesAtom;
 import org.apache.poi.hslf.record.TextCharsAtom;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
 import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.util.IOUtils;
@@ -102,7 +103,7 @@ public final class QuickButCruddyTextExt
 		fs = poifs;
 
 		// Find the PowerPoint bit, and get out the bytes
-		InputStream pptIs = fs.createDocumentInputStream("PowerPoint Document");
+		InputStream pptIs = fs.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT);
 		pptContents = IOUtils.toByteArray(pptIs);
 		pptIs.close();
 	}

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShow.java Wed May 31 14:10:18 2017
@@ -64,6 +64,9 @@ import org.apache.poi.util.Units;
  * understanding DocSlideList and DocNotesList) - handle Slide creation cleaner
  */
 public final class HSLFSlideShow implements SlideShow<HSLFShape,HSLFTextParagraph>, Closeable {
+    /** Powerpoint document entry/stream name */
+    public static final String POWERPOINT_DOCUMENT = "PowerPoint Document";
+    
     enum LoadSavePhase {
         INIT, LOADED
 	}
@@ -1078,7 +1081,7 @@ public final class HSLFSlideShow impleme
 
     protected static Map<String,ClassID> getOleMap() {
     	Map<String,ClassID> olemap = new HashMap<String,ClassID>();
-    	olemap.put("PowerPoint Document", ClassID.PPT_SHOW);
+    	olemap.put(POWERPOINT_DOCUMENT, ClassID.PPT_SHOW);
     	olemap.put("Workbook", ClassID.EXCEL97); // as per BIFF8 spec
     	olemap.put("WORKBOOK", ClassID.EXCEL97); // Typically from third party programs
     	olemap.put("BOOK", ClassID.EXCEL97); // Typically odd Crystal Reports exports

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java Wed May 31 14:10:18 2017
@@ -209,11 +209,11 @@ public final class HSLFSlideShowImpl ext
     private void readPowerPointStream() throws IOException {
         // Get the main document stream
         DocumentEntry docProps =
-                (DocumentEntry) getDirectory().getEntry("PowerPoint Document");
+                (DocumentEntry) getDirectory().getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
 
         // Grab the document stream
         int len = docProps.getSize();
-        InputStream is = getDirectory().createDocumentInputStream("PowerPoint Document");
+        InputStream is = getDirectory().createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT);
         try {
             _docstream = IOUtils.toByteArray(is, len);
         } finally {
@@ -701,8 +701,8 @@ public final class HSLFSlideShowImpl ext
 
         // Write the PPT stream into the POIFS layer
         ByteArrayInputStream bais = new ByteArrayInputStream(_docstream);
-        outFS.createOrUpdateDocument(bais, "PowerPoint Document");
-        writtenEntries.add("PowerPoint Document");
+        outFS.createOrUpdateDocument(bais, HSLFSlideShow.POWERPOINT_DOCUMENT);
+        writtenEntries.add(HSLFSlideShow.POWERPOINT_DOCUMENT);
 
         currentUser.setEncrypted(encryptedSS.getDocumentEncryptionAtom() != null);
         currentUser.writeToFS(outFS);

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java Wed May 31 14:10:18 2017
@@ -101,15 +101,15 @@ public final class TestReWrite {
         // Check all of them in turn
         for (POIFSFileSystem npf : new POIFSFileSystem[] { npfS, npfF, npfRF }) {
             // Check that the "PowerPoint Document" sections have the same size
-            DocumentEntry oProps = (DocumentEntry)pfs.getRoot().getEntry("PowerPoint Document");
-            DocumentEntry nProps = (DocumentEntry)npf.getRoot().getEntry("PowerPoint Document");
+            DocumentEntry oProps = (DocumentEntry)pfs.getRoot().getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
+            DocumentEntry nProps = (DocumentEntry)npf.getRoot().getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
             assertEquals(oProps.getSize(),nProps.getSize());
     
             // Check that they contain the same data
             byte[] _oData = new byte[oProps.getSize()];
             byte[] _nData = new byte[nProps.getSize()];
-            pfs.createDocumentInputStream("PowerPoint Document").read(_oData);
-            npf.createDocumentInputStream("PowerPoint Document").read(_nData);
+            pfs.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT).read(_oData);
+            npf.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT).read(_nData);
             for(int i=0; i<_oData.length; i++) {
                 //System.out.println(i + "\t" + Integer.toHexString(i));
                 assertEquals(_oData[i], _nData[i]);
@@ -174,15 +174,15 @@ public final class TestReWrite {
         POIFSFileSystem npfs = new POIFSFileSystem(bais);
 
         // Check that the "PowerPoint Document" sections have the same size
-        DocumentEntry oProps = (DocumentEntry)pfs.getRoot().getEntry("PowerPoint Document");
-        DocumentEntry nProps = (DocumentEntry)npfs.getRoot().getEntry("PowerPoint Document");
+        DocumentEntry oProps = (DocumentEntry)pfs.getRoot().getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
+        DocumentEntry nProps = (DocumentEntry)npfs.getRoot().getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
         assertEquals(oProps.getSize(),nProps.getSize());
 
         // Check that they contain the same data
         byte[] _oData = new byte[oProps.getSize()];
         byte[] _nData = new byte[nProps.getSize()];
-        pfs.createDocumentInputStream("PowerPoint Document").read(_oData);
-        npfs.createDocumentInputStream("PowerPoint Document").read(_nData);
+        pfs.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT).read(_oData);
+        npfs.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT).read(_nData);
         for(int i=0; i<_oData.length; i++) {
             if(_oData[i] != _nData[i])
                 System.out.println(i + "\t" + Integer.toHexString(i));

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java Wed May 31 14:10:18 2017
@@ -191,7 +191,7 @@ public final class TestExtractor {
     private PowerPointExtractor assertExtractFromEmbedded(DirectoryNode root, String entryName, String expected)
     throws IOException {
         DirectoryNode dir = (DirectoryNode)root.getEntry(entryName);
-        assertTrue(dir.hasEntry("PowerPoint Document"));
+        assertTrue(dir.hasEntry(HSLFSlideShow.POWERPOINT_DOCUMENT));
 
         // Check the first file
         HSLFSlideShowImpl ppt = new HSLFSlideShowImpl(dir);

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestLine.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestLine.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestLine.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestLine.java Wed May 31 14:10:18 2017
@@ -18,23 +18,22 @@
 package org.apache.poi.hslf.model;
 
 import java.awt.Color;
+import java.io.IOException;
 
+import org.apache.poi.hslf.usermodel.HSLFLine;
 import org.apache.poi.hslf.usermodel.HSLFSlide;
 import org.apache.poi.hslf.usermodel.HSLFSlideShow;
-import org.apache.poi.hslf.usermodel.HSLFLine;
 import org.apache.poi.sl.usermodel.StrokeStyle.LineCompound;
 import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
 import org.junit.Test;
 
 /**
  * Test Line shape.
- *
- * @author Yegor Kozlov
  */
 public final class TestLine {
 
     @Test
-    public void testCreateLines() {
+    public void testCreateLines() throws IOException {
         HSLFSlideShow ppt = new HSLFSlideShow();
 
         HSLFSlide slide = ppt.createSlide();
@@ -127,5 +126,7 @@ public final class TestLine {
         line.setLineCompound(LineCompound.DOUBLE);
         line.setLineWidth(8.0);
         slide.addShape(line);
+        
+        ppt.close();
     }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPFont.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPFont.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPFont.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPFont.java Wed May 31 14:10:18 2017
@@ -19,19 +19,19 @@ package org.apache.poi.hslf.model;
 
 import static org.junit.Assert.assertEquals;
 
+import java.io.IOException;
+
 import org.apache.poi.hslf.usermodel.HSLFSlideShow;
 import org.junit.Test;
 
 
 /**
  * Test adding fonts to the presenataion resources
- *
- * @author Yegor Kozlov
  */
 public final class TestPPFont {
 
     @Test
-    public void testCreate() {
+    public void testCreate() throws IOException {
         HSLFSlideShow ppt = new HSLFSlideShow();
         assertEquals(1, ppt.getNumberOfFonts());
         assertEquals("Arial", ppt.getFont(0).getFontName());
@@ -53,5 +53,7 @@ public final class TestPPFont {
         assertEquals(PPFont.WINGDINGS.getFontName(), font3.getFontName());
         assertEquals(PPFont.SYMBOL_CHARSET, font3.getCharSet());
         assertEquals(PPFont.VARIABLE_PITCH, font3.getPitchAndFamily());
+        
+        ppt.close();
     }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java Wed May 31 14:10:18 2017
@@ -22,19 +22,25 @@ import static org.junit.Assert.assertTru
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.util.List;
 
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.hslf.model.textproperties.CharFlagsTextProp;
 import org.apache.poi.hslf.record.Environment;
 import org.apache.poi.hslf.record.TextHeaderAtom;
-import org.apache.poi.hslf.usermodel.*;
+import org.apache.poi.hslf.usermodel.HSLFMasterSheet;
+import org.apache.poi.hslf.usermodel.HSLFSlide;
+import org.apache.poi.hslf.usermodel.HSLFSlideMaster;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
+import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
+import org.apache.poi.hslf.usermodel.HSLFTextRun;
+import org.apache.poi.hslf.usermodel.HSLFTitleMaster;
 import org.junit.Test;
 
 /**
  * Tests for SlideMaster
- *
- * @author Yegor Kozlov
  */
 public final class TestSlideMaster {
     private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
@@ -44,7 +50,7 @@ public final class TestSlideMaster {
      * Check we can read their attributes.
      */
     @Test
-    public void testSlideMaster() throws Exception {
+    public void testSlideMaster() throws IOException {
         HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
 
         Environment env = ppt.getDocumentRecord().getEnvironment();
@@ -79,13 +85,15 @@ public final class TestSlideMaster {
         int b2 = master.get(1).getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.font", false).getValue();
         assertEquals("Arial", env.getFontCollection().getFontWithId(b1));
         assertEquals("Georgia", env.getFontCollection().getFontWithId(b2));
+
+        ppt.close();
     }
 
     /**
      * Test we can read default text attributes for a title master sheet
      */
     @Test
-    public void testTitleMasterTextAttributes() throws Exception {
+    public void testTitleMasterTextAttributes() throws IOException {
         HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
         List<HSLFTitleMaster> master = ppt.getTitleMasters();
         assertEquals(1, master.size());
@@ -101,13 +109,15 @@ public final class TestSlideMaster {
         assertEquals(true, prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
         assertEquals(false, prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
         assertEquals(false, prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
+
+        ppt.close();
     }
 
     /**
      * Slide 3 has title layout and follows the TitleMaster. Verify that.
      */
     @Test
-    public void testTitleMaster() throws Exception {
+    public void testTitleMaster() throws IOException {
         HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
         HSLFSlide slide = ppt.getSlides().get(2);
         HSLFMasterSheet masterSheet = slide.getMasterSheet();
@@ -131,7 +141,9 @@ public final class TestSlideMaster {
             }
 
         }
+        ppt.close();
     }
+
     /**
      * If a style attribute is not set ensure it is read from the master
      */
@@ -178,13 +190,14 @@ public final class TestSlideMaster {
             }
         }
 
+        ppt.close();
     }
 
     /**
      * Check we can dynamically assign a slide master to a slide.
      */
     @Test
-    public void testChangeSlideMaster() throws Exception {
+    public void testChangeSlideMaster() throws IOException {
         HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
         List<HSLFSlideMaster> master = ppt.getSlideMasters();
         List<HSLFSlide> slide = ppt.getSlides();
@@ -212,6 +225,8 @@ public final class TestSlideMaster {
         for (HSLFSlide s : slide) {
             assertEquals(sheetNo, s.getMasterSheet()._getSheetNumber());
         }
+
+        ppt.close();
     }
 
     /**
@@ -219,10 +234,10 @@ public final class TestSlideMaster {
      * (typical for the "bullted body" placeholder)
      */
     @Test
-    public void testIndentation() throws Exception {
+    public void testIndentation() throws IOException {
         HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
         HSLFSlide slide = ppt.getSlides().get(0);
-        
+
         for (List<HSLFTextParagraph> tparas : slide.getTextParagraphs()) {
             HSLFTextParagraph tpara = tparas.get(0);
             if (tpara.getRunType() == TextHeaderAtom.TITLE_TYPE){
@@ -238,7 +253,6 @@ public final class TestSlideMaster {
                 }
             }
         }
-
+        ppt.close();
     }
-
-}
+}
\ No newline at end of file

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java Wed May 31 14:10:18 2017
@@ -17,14 +17,19 @@
 
 package org.apache.poi.hslf.model;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.util.List;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.hslf.usermodel.*;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
+import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
+import org.apache.poi.hslf.usermodel.HSLFTextRun;
+import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.junit.Before;
@@ -34,16 +39,10 @@ import org.junit.Test;
  * Tests that if we load something up, get a TextRun, set the text
  *  to be the same as it was before, and write it all back out again,
  *  that we don't break anything in the process.
- *
- * @author Nick Burch (nick at torchbox dot com)
  */
 public final class TestTextRunReWrite {
 	// HSLFSlideShow primed on the test data
-	private HSLFSlideShowImpl hss;
-	// HSLFSlideShow primed on the test data
 	private HSLFSlideShow ss;
-	// POIFS primed on the test data
-	private POIFSFileSystem pfs;
 
 	/**
 	 * Load up a test PPT file with rich data
@@ -52,13 +51,11 @@ public final class TestTextRunReWrite {
     public void setUp() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 		String filename = "Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
-		pfs = new POIFSFileSystem(slTests.openResourceAsStream(filename));
-		hss = new HSLFSlideShowImpl(pfs);
-		ss = new HSLFSlideShow(hss);
+		ss = new HSLFSlideShow(slTests.openResourceAsStream(filename));
     }
 
     @Test
-	public void testWritesOutTheSameNonRich() throws Exception {
+	public void testWritesOutTheSameNonRich() throws IOException {
     	// Ensure the text lengths are as we'd expect to start with
     	assertEquals(1, ss.getSlides().size());
     	assertEquals(2, ss.getSlides().get(0).getTextParagraphs().size());
@@ -103,23 +100,24 @@ public final class TestTextRunReWrite {
 		POIFSFileSystem npfs = new POIFSFileSystem(bais);
 
 		// Check that the "PowerPoint Document" sections have the same size
-		DocumentEntry oProps = (DocumentEntry)pfs.getRoot().getEntry("PowerPoint Document");
-		DocumentEntry nProps = (DocumentEntry)npfs.getRoot().getEntry("PowerPoint Document");
+		DirectoryNode oDir = ss.getSlideShowImpl().getDirectory();
+
+		DocumentEntry oProps = (DocumentEntry)oDir.getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
+		DocumentEntry nProps = (DocumentEntry)npfs.getRoot().getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
 		assertEquals(oProps.getSize(),nProps.getSize());
 
 		// Check that they contain the same data
 		byte[] _oData = new byte[oProps.getSize()];
 		byte[] _nData = new byte[nProps.getSize()];
-		pfs.createDocumentInputStream("PowerPoint Document").read(_oData);
-		npfs.createDocumentInputStream("PowerPoint Document").read(_nData);
-		for(int i=0; i<_oData.length; i++) {
-//			System.out.println(i + "\t" + Integer.toHexString(i));
-			assertEquals(_oData[i], _nData[i]);
-		}
+		oDir.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT).read(_oData);
+		npfs.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT).read(_nData);
+		assertArrayEquals(_oData, _nData);
+		
+		npfs.close();
 	}
 
     @Test
-    public void testWritesOutTheSameRich() throws Exception {
+    public void testWritesOutTheSameRich() throws IOException {
     	// Grab the first text run on the first sheet
     	List<HSLFTextParagraph> tr1 = ss.getSlides().get(0).getTextParagraphs().get(0);
 
@@ -160,18 +158,20 @@ public final class TestTextRunReWrite {
 		POIFSFileSystem npfs = new POIFSFileSystem(bais);
 
 		// Check that the "PowerPoint Document" sections have the same size
-		DocumentEntry oProps = (DocumentEntry)pfs.getRoot().getEntry("PowerPoint Document");
-		DocumentEntry nProps = (DocumentEntry)npfs.getRoot().getEntry("PowerPoint Document");
+        DirectoryNode oDir = ss.getSlideShowImpl().getDirectory();
+		
+		DocumentEntry oProps = (DocumentEntry)oDir.getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
+		DocumentEntry nProps = (DocumentEntry)npfs.getRoot().getEntry(HSLFSlideShow.POWERPOINT_DOCUMENT);
 		assertEquals(oProps.getSize(),nProps.getSize());
 
 		// Check that they contain the same data
 		byte[] _oData = new byte[oProps.getSize()];
 		byte[] _nData = new byte[nProps.getSize()];
-		pfs.createDocumentInputStream("PowerPoint Document").read(_oData);
-		npfs.createDocumentInputStream("PowerPoint Document").read(_nData);
-		for(int i=0; i<_oData.length; i++) {
-//			System.out.println(i + "\t" + Integer.toHexString(i) + "\t" + _oData[i]);
-			assertEquals(_oData[i], _nData[i]);
-		}
+
+		oDir.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT).read(_oData);
+		npfs.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT).read(_nData);
+		assertArrayEquals(_oData, _nData);
+		
+		npfs.close();
 	}
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java Wed May 31 14:10:18 2017
@@ -18,86 +18,48 @@
 package org.apache.poi.hslf.record;
 
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-
+import org.apache.poi.POIDataSamples;
 import org.apache.poi.hslf.usermodel.HSLFSlideShow;
 import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
-import org.apache.poi.POIDataSamples;
+import org.junit.Test;
 
 /**
  * Tests that ExHyperlink works properly.
- *
- * @author Nick Burch (nick at torchbox dot com)
  */
-public final class TestExHyperlink extends TestCase {
-	// From a real file
-	private final byte[] data_a = new byte[] {
-		0x0F, 00, 0xD7-256, 0x0F, 0xA8-256, 00, 00, 00,
-
-		00, 00, 0xD3-256, 0x0F, 04, 00, 00, 00,
-		03, 00, 00, 00,
-
-		00, 00, 0xBA-256, 0x0F, 0x46, 00, 00, 00,
-		0x68, 00, 0x74, 00, 0x74, 00, 0x70, 00,
-		0x3A, 00, 0x2F, 00, 0x2F, 00, 0x6A, 00,
-		0x61, 00, 0x6B, 00, 0x61, 00, 0x72, 00,
-		0x74, 00, 0x61, 00, 0x2E, 00, 0x61, 00,
-		0x70, 00, 0x61, 00, 0x63, 00, 0x68, 00,
-		0x65, 00, 0x2E, 00, 0x6F, 00, 0x72, 00,
-		0x67, 00, 0x2F, 00, 0x70, 00, 0x6F, 00,
-		0x69, 00, 0x2F, 00, 0x68, 00, 0x73, 00,
-		0x73, 00, 0x66, 00, 0x2F, 00,
-
-		0x10, 00, 0xBA-256, 0x0F, 0x46, 00, 00, 00,
-		0x68, 00, 0x74, 00, 0x74, 00, 0x70, 00,
-		0x3A, 00, 0x2F, 00, 0x2F, 00, 0x6A, 00,
-		0x61, 00, 0x6B, 00, 0x61, 00, 0x72, 00,
-		0x74, 00, 0x61, 00, 0x2E, 00, 0x61, 00,
-		0x70, 00, 0x61, 00, 0x63, 00, 0x68, 00,
-		0x65, 00, 0x2E, 00, 0x6F, 00, 0x72, 00,
-		0x67, 00, 0x2F, 00, 0x70, 00, 0x6F, 00,
-		0x69, 00, 0x2F, 00, 0x68, 00, 0x73, 00,
-		0x73, 00, 0x66, 00, 0x2F, 00
-	};
-
-    public void testRecordType() {
-    	ExHyperlink eh = new ExHyperlink(data_a, 0, data_a.length);
-		assertEquals(4055l, eh.getRecordType());
-	}
-
-    public void testNumber() {
-    	ExHyperlink eh = new ExHyperlink(data_a, 0, data_a.length);
-		assertEquals(3, eh.getExHyperlinkAtom().getNumber());
-    }
-
-	public void testLinkURL() {
-    	ExHyperlink eh = new ExHyperlink(data_a, 0, data_a.length);
-    	assertEquals("http://jakarta.apache.org/poi/hssf/", eh.getLinkURL());
-	}
-	public void testDetails() {
-    	ExHyperlink eh = new ExHyperlink(data_a, 0, data_a.length);
-    	assertEquals("http://jakarta.apache.org/poi/hssf/", eh._getDetailsA());
-    	assertEquals("http://jakarta.apache.org/poi/hssf/", eh._getDetailsB());
-	}
-
-	public void testWrite() throws Exception {
-    	ExHyperlink eh = new ExHyperlink(data_a, 0, data_a.length);
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		eh.writeOut(baos);
-		byte[] b = baos.toByteArray();
-
-		assertEquals(data_a.length, b.length);
-		for(int i=0; i<data_a.length; i++) {
-			assertEquals(data_a[i],b[i]);
-		}
+public final class TestExHyperlink {
+	@Test
+    public void testReadWrite() throws IOException {
+        // From a real file
+        byte[] exHyperlinkBytes = org.apache.poi.poifs.storage.RawDataUtil.decompress(
+            "H4sIAAAAAAAAAONnuM6/ggEELvOzAElmMHsXvxuQzGAoAcICBisGfSDMYkhkyAbi"+
+            "IqBYIoMeEBcAcTJQVSqQlw8UTweqKgCyMoF0BkMxEKYBWQJUNQ0A/k1x3rAAAAA="
+        );
+	    ExHyperlink exHyperlink = new ExHyperlink(exHyperlinkBytes, 0, exHyperlinkBytes.length);
+
+	    
+	    assertEquals(4055l, exHyperlink.getRecordType());
+        assertEquals(3, exHyperlink.getExHyperlinkAtom().getNumber());
+        String expURL = "http://jakarta.apache.org/poi/hssf/";
+        assertEquals(expURL, exHyperlink.getLinkURL());
+        assertEquals(expURL, exHyperlink._getDetailsA());
+        assertEquals(expURL, exHyperlink._getDetailsB());
+	
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        exHyperlink.writeOut(baos);
+        assertArrayEquals(exHyperlinkBytes, baos.toByteArray());
 	}
 
-	public void testRealFile() throws Exception {
+	@Test
+	public void testRealFile() throws IOException {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 		HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("WithLinks.ppt"));
 		HSLFSlideShow ss = new HSLFSlideShow(hss);
@@ -111,9 +73,8 @@ public final class TestExHyperlink exten
 				exObjList = (ExObjList)rec;
 			}
 		}
-		if (exObjList == null) {
-			throw new AssertionFailedError("exObjList must not be null");
-		}
+
+		assertNotNull(exObjList);
 
 		// Within that, grab out the Hyperlink atoms
 		List<ExHyperlink> linksA = new ArrayList<ExHyperlink>();
@@ -145,5 +106,6 @@ public final class TestExHyperlink exten
 		assertEquals(4, links[3].getExHyperlinkAtom().getNumber());
 		assertEquals("http://jakarta.apache.org/hslf/", links[3].getLinkURL());
 
+	    ss.close();
 	}
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java Wed May 31 14:10:18 2017
@@ -18,22 +18,21 @@
 package org.apache.poi.hslf.record;
 
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
-import org.apache.poi.hslf.usermodel.HSLFSlideShow;
-import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
+import org.junit.Test;
 
 /**
  * Tests that ExObjList works properly.
- *
- * @author Nick Burch (nick at torchbox dot com)
  */
-public class TestExObjList extends TestCase {
-	public void testRealFile() throws Exception {
+public class TestExObjList {
+    @Test
+    public void testRealFile() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
-		HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("WithLinks.ppt"));
-		HSLFSlideShow ss = new HSLFSlideShow(hss);
+		HSLFSlideShow ss = new HSLFSlideShow(slTests.openResourceAsStream("WithLinks.ppt"));
 
 		// Get the document
 		Document doc = ss.getDocumentRecord();
@@ -65,5 +64,6 @@ public class TestExObjList extends TestC
 		assertEquals(4, links[3].getExHyperlinkAtom().getNumber());
 		assertEquals("http://jakarta.apache.org/hslf/", links[3].getLinkURL());
 
+	    ss.close();
 	}
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java Wed May 31 14:10:18 2017
@@ -18,20 +18,22 @@
 package org.apache.poi.hslf.record;
 
 import static org.junit.Assert.assertArrayEquals;
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
 
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.hslf.usermodel.HSLFSlideShow;
+import org.junit.Test;
 
 /**
  * Tests Sound-related records: SoundCollection(2020), Sound(2022) and
  * SoundData(2023)).
- *
- * @author Yegor Kozlov
  */
-public final class TestSound extends TestCase {
-	public void testRealFile() throws Exception {
+public final class TestSound {
+    @Test
+	public void testRealFile() throws IOException {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
 		HSLFSlideShow ppt = new HSLFSlideShow(slTests.openResourceAsStream("sound.ppt"));
@@ -46,9 +48,7 @@ public final class TestSound extends Tes
 				break;
 			}
 		}
-		if (soundCollection == null) {
-			throw new AssertionFailedError("soundCollection must not be null");
-		}
+		assertNotNull(soundCollection);
 
 		Sound sound = null;
 		Record[] sound_ch = soundCollection.getChildRecords();
@@ -59,9 +59,8 @@ public final class TestSound extends Tes
 				k++;
 			}
 		}
-		if (sound == null) {
-			throw new AssertionFailedError("sound must not be null");
-		}
+		
+		assertNotNull(sound);
 		assertEquals(1, k);
 
 		assertEquals("ringin.wav", sound.getSoundName());
@@ -70,5 +69,7 @@ public final class TestSound extends Tes
 
 		byte[] ref_data = slTests.readFile("ringin.wav");
 		assertArrayEquals(ref_data, sound.getSoundData());
-	}
+
+		ppt.close();
+    }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestFontRendering.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestFontRendering.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestFontRendering.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestFontRendering.java Wed May 31 14:10:18 2017
@@ -23,6 +23,7 @@ import static org.junit.Assume.assumeTru
 import java.awt.Color;
 import java.awt.Dimension;
 import java.awt.Font;
+import java.awt.FontFormatException;
 import java.awt.Graphics2D;
 import java.awt.GraphicsEnvironment;
 import java.awt.RenderingHints;
@@ -31,6 +32,7 @@ import java.awt.geom.Rectangle2D;
 import java.awt.image.BufferedImage;
 import java.awt.image.DataBufferByte;
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -51,7 +53,7 @@ public class TestFontRendering {
 
     // @Ignore2("This fails on some systems because fonts are rendered slightly different")
     @Test
-    public void bug55902mixedFontWithChineseCharacters() throws Exception {
+    public void bug55902mixedFontWithChineseCharacters() throws IOException, FontFormatException {
         // font files need to be downloaded first via
         // ant test-scratchpad-download-resources
         String fontFiles[][] = {
@@ -117,5 +119,6 @@ public class TestFontRendering {
         }
         
         assertArrayEquals("Expected to have matching raster-arrays, but found differences", expectedData, actualData);
+        ss.close();
     }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList2.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList2.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList2.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList2.java Wed May 31 14:10:18 2017
@@ -19,14 +19,19 @@
 
 package org.apache.poi.hslf.usermodel;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
+import java.io.IOException;
 import java.util.List;
 
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.hslf.model.textproperties.TextPFException9;
 import org.apache.poi.hslf.model.textproperties.TextPropCollection;
-import org.apache.poi.hslf.record.*;
+import org.apache.poi.hslf.record.EscherTextboxWrapper;
+import org.apache.poi.hslf.record.StyleTextProp9Atom;
+import org.apache.poi.hslf.record.StyleTextPropAtom;
 import org.apache.poi.sl.usermodel.AutoNumberingScheme;
 import org.junit.Test;
 
@@ -36,14 +41,12 @@ import org.junit.Test;
  * if a paragraph has autonumber ()
  * @see <a href="http://social.msdn.microsoft.com/Forums/mr-IN/os_binaryfile/thread/650888db-fabd-4b95-88dc-f0455f6e2d28">
  *     PPT: Missing TextAutoNumberScheme structure providing the style of the number bullets</a>
- * 
- * @author Alex Nikiforov [mailto:anikif@gmail.com]
  */
 public final class TestNumberedList2 {
     private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     @Test
-	public void testNumberedList() throws Exception {
+	public void testNumberedList() throws IOException {
 		HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("numbers2.ppt"));
 		assertTrue("No Exceptions while reading file", true);
 
@@ -51,8 +54,11 @@ public final class TestNumberedList2 {
 		assertEquals(2, slides.size());
 		checkSlide0(slides.get(0));
 		checkSlide1(slides.get(1));
-	}
-	private void checkSlide0(final HSLFSlide s) {
+
+		ppt.close();
+    }
+
+    private void checkSlide0(final HSLFSlide s) {
 		final StyleTextProp9Atom[] numberedListArray = s.getNumberedListInfo();
 		assertNotNull(numberedListArray);
 		assertEquals(2, numberedListArray.length);
@@ -89,6 +95,7 @@ public final class TestNumberedList2 {
 		checkSingleRunWrapper(44, styleAtoms[0]);
 		checkSingleRunWrapper(130, styleAtoms[1]);
 	}
+    
 	private void checkSlide1(final HSLFSlide s) {
 		final StyleTextProp9Atom[] numberedListArray = s.getNumberedListInfo();
 		assertNotNull(numberedListArray);
@@ -119,6 +126,7 @@ public final class TestNumberedList2 {
 		checkSingleRunWrapper(67, styleAtoms[1]);
 		checkSingleRunWrapper(70, styleAtoms[2]);
 	}
+	
 	private void checkSingleRunWrapper(final int exceptedLength, final EscherTextboxWrapper wrapper) {
 		final StyleTextPropAtom styleTextPropAtom = wrapper.getStyleTextPropAtom();
 		final List<TextPropCollection> textProps = styleTextPropAtom.getCharacterStyles();

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java Wed May 31 14:10:18 2017
@@ -22,15 +22,15 @@ import static org.junit.Assert.assertEqu
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.hslf.HSLFTestDataSamples;
 import org.junit.Before;
 import org.junit.Test;
 
 /**
  * Tests that SlideShow can re-order slides properly
- *
- * @author Nick Burch (nick at torchbox dot com)
  */
 public final class TestReOrderingSlides {
 	// A SlideShow with one slide
@@ -66,7 +66,7 @@ public final class TestReOrderingSlides
 	 * Test that we can "re-order" a slideshow with only 1 slide on it
 	 */
 	@Test
-	public void testReOrder1() throws Exception {
+	public void testReOrder1() throws IOException {
 		// Has one slide
 		assertEquals(1, ss_one.getSlides().size());
 		HSLFSlide s1 = ss_one.getSlides().get(0);
@@ -80,12 +80,7 @@ public final class TestReOrderingSlides
 		ss_one.reorderSlide(1, 1);
 
 		// Write out, and read back in
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		hss_one.write(baos);
-		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
-		HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
-		HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
+        HSLFSlideShow ss_read = HSLFTestDataSamples.writeOutAndReadBack(ss_one);
 
 		// Check it still has 1 slide
 		assertEquals(1, ss_read.getSlides().size());
@@ -95,6 +90,8 @@ public final class TestReOrderingSlides
 		assertEquals(256, s1._getSheetNumber());
 		assertEquals(3, s1._getSheetRefId());
 		assertEquals(1, s1.getSlideNumber());
+		
+		ss_read.close();
 	}
 
 	/**
@@ -102,7 +99,7 @@ public final class TestReOrderingSlides
 	 *  two slides in it
 	 */
     @Test
-	public void testReOrder2() throws Exception {
+	public void testReOrder2() throws IOException {
 		// Has two slides
 		assertEquals(2, ss_two.getSlides().size());
 		HSLFSlide s1 = ss_two.getSlides().get(0);
@@ -121,12 +118,7 @@ public final class TestReOrderingSlides
 		ss_two.reorderSlide(2, 2);
 
 		// Write out, and read back in
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		hss_two.write(baos);
-		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
-		HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
-		HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
+        HSLFSlideShow ss_read = HSLFTestDataSamples.writeOutAndReadBack(ss_two);
 
 		// Check it still has 2 slides
 		assertEquals(2, ss_read.getSlides().size());
@@ -140,13 +132,15 @@ public final class TestReOrderingSlides
 		assertEquals(257, s2._getSheetNumber());
 		assertEquals(6, s2._getSheetRefId());
 		assertEquals(2, s2.getSlideNumber());
-	}
+
+        ss_read.close();
+    }
 
 	/**
 	 * Test re-ordering slides in a slideshow with 2 slides on it
 	 */
     @Test
-	public void testReOrder2swap() throws Exception {
+	public void testReOrder2swap() throws IOException {
 		// Has two slides
 		assertEquals(2, ss_two.getSlides().size());
 		HSLFSlide s1 = ss_two.getSlides().get(0);
@@ -165,12 +159,7 @@ public final class TestReOrderingSlides
 		ss_two.reorderSlide(2, 1);
 
 		// Write out, and read back in
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		hss_two.write(baos);
-		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
-		HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
-		HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
+        HSLFSlideShow ss_read = HSLFTestDataSamples.writeOutAndReadBack(ss_two);
 
 		// Check it still has 2 slides
 		assertEquals(2, ss_read.getSlides().size());
@@ -184,14 +173,16 @@ public final class TestReOrderingSlides
 		assertEquals(256, s2._getSheetNumber());
 		assertEquals(4, s2._getSheetRefId());
 		assertEquals(2, s2.getSlideNumber());
-	}
+
+		ss_read.close();
+    }
 
 	/**
 	 * Test doing a dummy re-order on a slideshow with
 	 *  three slides in it
 	 */
     @Test
-	public void testReOrder3() throws Exception {
+	public void testReOrder3() throws IOException {
 		// Has three slides
 		assertEquals(3, ss_three.getSlides().size());
 		HSLFSlide s1 = ss_three.getSlides().get(0);
@@ -215,12 +206,7 @@ public final class TestReOrderingSlides
 		ss_three.reorderSlide(2, 2);
 
 		// Write out, and read back in
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		hss_three.write(baos);
-		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
-		HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
-		HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
+        HSLFSlideShow ss_read = HSLFTestDataSamples.writeOutAndReadBack(ss_three);
 
 		// Check it still has 3 slides
 		assertEquals(3, ss_read.getSlides().size());
@@ -239,13 +225,15 @@ public final class TestReOrderingSlides
 		assertEquals(257, s3._getSheetNumber());
 		assertEquals(4, s3._getSheetRefId());
 		assertEquals(3, s3.getSlideNumber());
-	}
+
+        ss_read.close();
+    }
 
 	/**
 	 * Test re-ordering slides in a slideshow with 3 slides on it
 	 */
     @Test
-	public void testReOrder3swap() throws Exception {
+	public void testReOrder3swap() throws IOException {
 		// Has three slides
 		assertEquals(3, ss_three.getSlides().size());
 		HSLFSlide s1 = ss_three.getSlides().get(0);
@@ -282,12 +270,7 @@ public final class TestReOrderingSlides
         assertEquals("Slide 1", ((HSLFTextShape)s3.getShapes().get(0)).getText());
 
 		// Write out, and read back in
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		hss_three.write(baos);
-		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
-		HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
-		HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
+        HSLFSlideShow ss_read = HSLFTestDataSamples.writeOutAndReadBack(ss_three);
 
 		// Check it still has 3 slides
 		assertEquals(3, ss_read.getSlides().size());
@@ -311,5 +294,7 @@ public final class TestReOrderingSlides
         assertEquals(s3._getSheetNumber(), _s3._getSheetNumber());
         assertEquals(s3._getSheetRefId(), _s3._getSheetRefId());
 		assertEquals(3, s3.getSlideNumber());
+		
+		ss_read.close();
 	}
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java Wed May 31 14:10:18 2017
@@ -397,7 +397,7 @@ public final class TestRichTextRun {
 	private static void assertMatchesFileC(HSLFSlideShow s) throws IOException {
 		// Grab the bytes of the file
 	    NPOIFSFileSystem fs = new NPOIFSFileSystem(HSLFTestDataSamples.openSampleFileStream(filenameC));
-	    InputStream is = fs.createDocumentInputStream("PowerPoint Document");
+	    InputStream is = fs.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT);
 	    byte[] raw_file = IOUtils.toByteArray(is);
 	    is.close();
 	    fs.close();
@@ -406,7 +406,7 @@ public final class TestRichTextRun {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
 		s.write(baos);
 		fs = new NPOIFSFileSystem(new ByteArrayInputStream(baos.toByteArray()));
-		is = fs.createDocumentInputStream("PowerPoint Document");
+		is = fs.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT);
 		byte[] raw_ss = IOUtils.toByteArray(is);
         is.close();
         fs.close();		

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java Wed May 31 14:10:18 2017
@@ -49,9 +49,9 @@ public final class TestPOIFSChunkParser
    private final POIDataSamples samples = POIDataSamples.getHSMFInstance();
 
    @Test
-   public void testFindsCore() throws Exception {
+   public void testFindsCore() throws IOException, ChunkNotFoundException {
       NPOIFSFileSystem simple = new NPOIFSFileSystem(samples.getFile("quick.msg"), true);
-      
+
       // Check a few core things are present
       simple.getRoot().getEntry(
             (new StringChunk(MAPIProperty.SUBJECT.id, Types.ASCII_STRING)).getEntryName()
@@ -59,24 +59,26 @@ public final class TestPOIFSChunkParser
       simple.getRoot().getEntry(
             (new StringChunk(MAPIProperty.SENDER_NAME.id, Types.ASCII_STRING)).getEntryName()
       );
-      
+
       // Now load the file
       MAPIMessage msg = new MAPIMessage(simple);
       assertEquals("Kevin Roast", msg.getDisplayTo());
       assertEquals("Kevin Roast", msg.getDisplayFrom());
       assertEquals("Test the content transformer", msg.getSubject());
-      
+
       // Check date too
       Calendar calExp = LocaleUtil.getLocaleCalendar(2007,5,14,9,42,55);
       Calendar calAct = msg.getMessageDate();
       assertEquals( calExp, calAct );
 
+      msg.close();
       simple.close();
    }
-   
+
+   @Test
    public void testFindsRecips() throws IOException, ChunkNotFoundException {
       NPOIFSFileSystem simple = new NPOIFSFileSystem(samples.getFile("quick.msg"), true);
-      
+
       simple.getRoot().getEntry("__recip_version1.0_#00000000");
 
       ChunkGroup[] groups = POIFSChunkParser.parse(simple.getRoot());
@@ -84,59 +86,62 @@ public final class TestPOIFSChunkParser
       assertTrue(groups[0] instanceof Chunks);
       assertTrue(groups[1] instanceof RecipientChunks);
       assertTrue(groups[2] instanceof NameIdChunks);
-      
+
       RecipientChunks recips = (RecipientChunks)groups[1];
       assertEquals("kevin.roast@alfresco.org", recips.recipientSMTPChunk.getValue());
-      assertEquals("/O=HOSTEDSERVICE2/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=Kevin.roast@ben", 
+      assertEquals("/O=HOSTEDSERVICE2/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=Kevin.roast@ben",
             recips.recipientEmailChunk.getValue());
-      
+
       String search = new String(recips.recipientSearchChunk.getValue(), "ASCII");
       assertEquals("CN=KEVIN.ROAST@BEN\0", search.substring(search.length()-19));
-      
+
       // Now via MAPIMessage
       MAPIMessage msg = new MAPIMessage(simple);
       assertNotNull(msg.getRecipientDetailsChunks());
       assertEquals(1, msg.getRecipientDetailsChunks().length);
-      
+
       assertEquals("kevin.roast@alfresco.org", msg.getRecipientDetailsChunks()[0].recipientSMTPChunk.getValue());
       assertEquals("kevin.roast@alfresco.org", msg.getRecipientDetailsChunks()[0].getRecipientEmailAddress());
       assertEquals("Kevin Roast", msg.getRecipientDetailsChunks()[0].getRecipientName());
       assertEquals("kevin.roast@alfresco.org", msg.getRecipientEmailAddress());
-      
-      
+
+
       // Try both SMTP and EX files for recipient
       assertEquals("EX", msg.getRecipientDetailsChunks()[0].deliveryTypeChunk.getValue());
       assertEquals("kevin.roast@alfresco.org", msg.getRecipientDetailsChunks()[0].recipientSMTPChunk.getValue());
-      assertEquals("/O=HOSTEDSERVICE2/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=Kevin.roast@ben", 
+      assertEquals("/O=HOSTEDSERVICE2/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=Kevin.roast@ben",
             msg.getRecipientDetailsChunks()[0].recipientEmailChunk.getValue());
+      msg.close();
       simple.close();
-      
-      
+
+
       // Now look at another message
       simple = new NPOIFSFileSystem(samples.getFile("simple_test_msg.msg"), true);
       msg = new MAPIMessage(simple);
       assertNotNull(msg.getRecipientDetailsChunks());
       assertEquals(1, msg.getRecipientDetailsChunks().length);
-      
+
       assertEquals("SMTP", msg.getRecipientDetailsChunks()[0].deliveryTypeChunk.getValue());
       assertEquals(null, msg.getRecipientDetailsChunks()[0].recipientSMTPChunk);
       assertEquals(null, msg.getRecipientDetailsChunks()[0].recipientNameChunk);
       assertEquals("travis@overwrittenstack.com", msg.getRecipientDetailsChunks()[0].recipientEmailChunk.getValue());
       assertEquals("travis@overwrittenstack.com", msg.getRecipientEmailAddress());
-      
+
+      msg.close();
       simple.close();
    }
-   
+
+   @Test
    public void testFindsMultipleRecipients() throws IOException, ChunkNotFoundException {
       NPOIFSFileSystem multiple = new NPOIFSFileSystem(samples.getFile("example_received_unicode.msg"), true);
-      
+
       multiple.getRoot().getEntry("__recip_version1.0_#00000000");
       multiple.getRoot().getEntry("__recip_version1.0_#00000001");
       multiple.getRoot().getEntry("__recip_version1.0_#00000002");
       multiple.getRoot().getEntry("__recip_version1.0_#00000003");
       multiple.getRoot().getEntry("__recip_version1.0_#00000004");
       multiple.getRoot().getEntry("__recip_version1.0_#00000005");
-      
+
       ChunkGroup[] groups = POIFSChunkParser.parse(multiple.getRoot());
       assertEquals(9, groups.length);
       assertTrue(groups[0] instanceof Chunks);
@@ -148,7 +153,7 @@ public final class TestPOIFSChunkParser
       assertTrue(groups[6] instanceof RecipientChunks);
       assertTrue(groups[7] instanceof RecipientChunks);
       assertTrue(groups[8] instanceof NameIdChunks);
-      
+
       // In FS order initially
       RecipientChunks[] chunks = new RecipientChunks[] {
             (RecipientChunks)groups[1],
@@ -165,7 +170,7 @@ public final class TestPOIFSChunkParser
       assertEquals(5, chunks[3].recipientNumber);
       assertEquals(3, chunks[4].recipientNumber);
       assertEquals(1, chunks[5].recipientNumber);
-      
+
       // Check
       assertEquals("'Ashutosh Dandavate'", chunks[0].getRecipientName());
       assertEquals("ashutosh.dandavate@alfresco.com", chunks[0].getRecipientEmailAddress());
@@ -179,10 +184,10 @@ public final class TestPOIFSChunkParser
       assertEquals("nickb@alfresco.com", chunks[4].getRecipientEmailAddress());
       assertEquals("'Paul Holmes-Higgin'", chunks[5].getRecipientName());
       assertEquals("paul.hh@alfresco.com", chunks[5].getRecipientEmailAddress());
-      
+
       // Now sort, and re-check
       Arrays.sort(chunks, new RecipientChunksSorter());
-      
+
       assertEquals("'Ashutosh Dandavate'", chunks[0].getRecipientName());
       assertEquals("ashutosh.dandavate@alfresco.com", chunks[0].getRecipientEmailAddress());
       assertEquals("'Paul Holmes-Higgin'", chunks[1].getRecipientName());
@@ -195,32 +200,34 @@ public final class TestPOIFSChunkParser
       assertEquals("nick.burch@alfresco.com", chunks[4].getRecipientEmailAddress());
       assertEquals("'Roy Wetherall'", chunks[5].getRecipientName());
       assertEquals("roy.wetherall@alfresco.com", chunks[5].getRecipientEmailAddress());
-      
+
       // Finally check on message
       MAPIMessage msg = new MAPIMessage(multiple);
       assertEquals(6, msg.getRecipientEmailAddressList().length);
       assertEquals(6, msg.getRecipientNamesList().length);
-      
+
       assertEquals("'Ashutosh Dandavate'", msg.getRecipientNamesList()[0]);
       assertEquals("'Paul Holmes-Higgin'", msg.getRecipientNamesList()[1]);
       assertEquals("'Mike Farman'",        msg.getRecipientNamesList()[2]);
       assertEquals("nickb@alfresco.com",   msg.getRecipientNamesList()[3]);
       assertEquals("nick.burch@alfresco.com", msg.getRecipientNamesList()[4]);
       assertEquals("'Roy Wetherall'",      msg.getRecipientNamesList()[5]);
-      
+
       assertEquals("ashutosh.dandavate@alfresco.com", msg.getRecipientEmailAddressList()[0]);
       assertEquals("paul.hh@alfresco.com",            msg.getRecipientEmailAddressList()[1]);
       assertEquals("mikef@alfresco.com",              msg.getRecipientEmailAddressList()[2]);
       assertEquals("nickb@alfresco.com",              msg.getRecipientEmailAddressList()[3]);
       assertEquals("nick.burch@alfresco.com",         msg.getRecipientEmailAddressList()[4]);
       assertEquals("roy.wetherall@alfresco.com",      msg.getRecipientEmailAddressList()[5]);
-      
+
+      msg.close();
       multiple.close();
    }
-   
+
+   @Test
    public void testFindsNameId() throws IOException {
       NPOIFSFileSystem simple = new NPOIFSFileSystem(samples.getFile("quick.msg"), true);
-      
+
       simple.getRoot().getEntry("__nameid_version1.0");
 
       ChunkGroup[] groups = POIFSChunkParser.parse(simple.getRoot());
@@ -228,29 +235,31 @@ public final class TestPOIFSChunkParser
       assertTrue(groups[0] instanceof Chunks);
       assertTrue(groups[1] instanceof RecipientChunks);
       assertTrue(groups[2] instanceof NameIdChunks);
-      
+
       NameIdChunks nameId = (NameIdChunks)groups[2];
       assertEquals(10, nameId.getAll().length);
-      
+
       // Now via MAPIMessage
       MAPIMessage msg = new MAPIMessage(simple);
       assertNotNull(msg.getNameIdChunks());
       assertEquals(10, msg.getNameIdChunks().getAll().length);
-      
+
+      msg.close();
       simple.close();
    }
-   
-   public void testFindsAttachments() throws Exception {
+
+   @Test
+   public void testFindsAttachments() throws IOException, ChunkNotFoundException {
 	  NPOIFSFileSystem with = new NPOIFSFileSystem(samples.getFile("attachment_test_msg.msg"), true);
       NPOIFSFileSystem without = new NPOIFSFileSystem(samples.getFile("quick.msg"), true);
       AttachmentChunks attachment;
-      
-      
+
+
       // Check raw details on the one with
       with.getRoot().getEntry("__attach_version1.0_#00000000");
       with.getRoot().getEntry("__attach_version1.0_#00000001");
       POIFSChunkParser.parse(with.getRoot());
-      
+
       ChunkGroup[] groups = POIFSChunkParser.parse(with.getRoot());
       assertEquals(5, groups.length);
       assertTrue(groups[0] instanceof Chunks);
@@ -258,22 +267,22 @@ public final class TestPOIFSChunkParser
       assertTrue(groups[2] instanceof AttachmentChunks);
       assertTrue(groups[3] instanceof AttachmentChunks);
       assertTrue(groups[4] instanceof NameIdChunks);
-      
+
       attachment = (AttachmentChunks)groups[2];
       assertEquals("TEST-U~1.DOC", attachment.getAttachFileName().toString());
       assertEquals("test-unicode.doc", attachment.getAttachLongFileName().toString());
       assertEquals(24064, attachment.getAttachData().getValue().length);
-      
+
       attachment = (AttachmentChunks)groups[3];
       assertEquals("pj1.txt", attachment.getAttachFileName().toString());
       assertEquals("pj1.txt", attachment.getAttachLongFileName().toString());
       assertEquals(89, attachment.getAttachData().getValue().length);
-	   
-      
+
+
       // Check raw details on one without
       assertFalse(without.getRoot().hasEntry("__attach_version1.0_#00000000"));
       assertFalse(without.getRoot().hasEntry("__attach_version1.0_#00000001"));
-      
+
 	   // One with, from the top
       MAPIMessage msgWith = new MAPIMessage(with);
       assertEquals(2, msgWith.getAttachmentFiles().length);
@@ -282,45 +291,49 @@ public final class TestPOIFSChunkParser
       assertEquals("TEST-U~1.DOC", attachment.getAttachFileName().toString());
       assertEquals("test-unicode.doc", attachment.getAttachLongFileName().toString());
       assertEquals(24064, attachment.getAttachData().getValue().length);
-      
+
       attachment = msgWith.getAttachmentFiles()[1];
       assertEquals("pj1.txt", attachment.getAttachFileName().toString());
       assertEquals("pj1.txt", attachment.getAttachLongFileName().toString());
       assertEquals(89, attachment.getAttachData().getValue().length);
-      
+
       // Plus check core details are there
       assertEquals("'nicolas1.23456@free.fr'", msgWith.getDisplayTo());
       assertEquals("Nicolas1 23456", msgWith.getDisplayFrom());
       assertEquals("test pi\u00e8ce jointe 1", msgWith.getSubject());
-      
+
 	   // One without, from the top
       MAPIMessage msgWithout = new MAPIMessage(without);
-      
+
       // No attachments
       assertEquals(0, msgWithout.getAttachmentFiles().length);
-      
+
       // But has core details
       assertEquals("Kevin Roast", msgWithout.getDisplayTo());
       assertEquals("Kevin Roast", msgWithout.getDisplayFrom());
       assertEquals("Test the content transformer", msgWithout.getSubject());
 
+      msgWithout.close();
+      msgWith.close();
       without.close();
       with.close();
    }
-	
+
    /**
     * Bugzilla #51873 - Outlook 2002 files created with dragging and
     *  dropping files to the disk include a non-standard named streams
     *  such as "Olk10SideProps_0001"
     */
-   public void testOlk10SideProps() throws Exception {
+   @Test
+   public void testOlk10SideProps() throws IOException, ChunkNotFoundException {
       NPOIFSFileSystem poifs = new NPOIFSFileSystem(samples.getFile("51873.msg"), true);
       MAPIMessage msg = new MAPIMessage(poifs);
 
       // Check core details came through
       assertEquals("bubba@bubbasmith.com", msg.getDisplayTo());
       assertEquals("Test with Olk10SideProps_ Chunk", msg.getSubject());
-      
+
+      msg.close();
       poifs.close();
    }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestHWPFOldDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestHWPFOldDocument.java?rev=1797043&r1=1797042&r2=1797043&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestHWPFOldDocument.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestHWPFOldDocument.java Wed May 31 14:10:18 2017
@@ -158,6 +158,8 @@ public final class TestHWPFOldDocument e
         assertContains(txt, "APPLICOLOR");
         assertContains(txt, "les meilleurs");
         assertContains(txt, "GUY LECOLE");
+        ex.close();
+        doc.close();
     }
 
 
@@ -172,6 +174,8 @@ public final class TestHWPFOldDocument e
             sb.append(p);
         }
         assertContains(sb.toString(), "\u043F\u0440\u0438\u0432\u0435\u0442");//Greetings!
+        ex.close();
+        doc.close();
     }
 
     @Test
@@ -187,6 +191,8 @@ public final class TestHWPFOldDocument e
             sb.append(p);
         }
         assertContains(sb.toString(), "4 sk\u00f3re a p\u0159ed 7 lety");//Greetings!
+        ex.close();
+        doc.close();
     }
 
     @Test
@@ -249,6 +255,8 @@ public final class TestHWPFOldDocument e
         //TODO: figure out why these two aren't passing
         //assertContains(txt, "\u2019\u0078 block2");//make sure smart quote is extracted correctly
         //assertContains(txt, "We are able to");//not sure if we can get this easily?
+        ex.close();
+        doc.close();
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message