poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1724445 - in /poi/trunk/src: ooxml/java/org/apache/poi/xssf/eventusermodel/ ooxml/testcases/org/apache/poi/xwpf/usermodel/ scratchpad/testcases/org/apache/poi/hwpf/ testcases/org/apache/poi/hpsf/basic/ testcases/org/apache/poi/ss/formula/e...
Date Wed, 13 Jan 2016 15:59:39 GMT
Author: centic
Date: Wed Jan 13 15:59:38 2016
New Revision: 1724445

URL: http://svn.apache.org/viewvc?rev=1724445&view=rev
Log:
Bug 58829: Remove some useages of printStackTrace() and some other minor cleanups

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFDocFixture.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestMetaDataIPI.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/basic/Util.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestRangeEval.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java?rev=1724445&r1=1724444&r2=1724445&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java Wed
Jan 13 15:59:38 2016
@@ -16,14 +16,12 @@
 ==================================================================== */
 package org.apache.poi.xssf.eventusermodel;
 
-import java.util.Comparator;
 import java.util.LinkedList;
 import java.util.Queue;
 
 import org.apache.poi.ss.usermodel.BuiltinFormats;
 import org.apache.poi.ss.usermodel.DataFormatter;
 import org.apache.poi.ss.util.CellAddress;
-import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
 import org.apache.poi.xssf.model.CommentsTable;

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java?rev=1724445&r1=1724444&r2=1724445&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java Wed Jan 13
15:59:38 2016
@@ -38,16 +38,22 @@ import org.openxmlformats.schemas.wordpr
 /**
  * Tests for XWPF Run
  */
+@SuppressWarnings("deprecation")
 public class TestXWPFRun extends TestCase {
-    public CTR ctRun;
-    public XWPFParagraph p;
+    private CTR ctRun;
+    private XWPFParagraph p;
+    private XWPFDocument doc;
 
     protected void setUp() {
-        XWPFDocument doc = new XWPFDocument();
+        doc = new XWPFDocument();
         p = doc.createParagraph();
 
         this.ctRun = CTR.Factory.newInstance();
     }
+    
+    protected void tearDown() throws Exception {
+        doc.close();
+    }
 
     public void testSetGetText() {
         ctRun.addNewT().setStringValue("TEST STRING");
@@ -410,6 +416,13 @@ public class TestXWPFRun extends TestCas
 
         assertEquals(1, doc.getAllPictures().size());
         assertEquals(1, r.getEmbeddedPictures().size());
+        
+        XWPFDocument docBack = XWPFTestDataSamples.writeOutAndReadBack(doc);
+        XWPFParagraph pBack = docBack.getParagraphArray(2);
+        XWPFRun rBack = pBack.getRuns().get(0);
+        
+        assertEquals(1, docBack.getAllPictures().size());
+        assertEquals(1, rBack.getEmbeddedPictures().size());
     }
 
     /**

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFDocFixture.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFDocFixture.java?rev=1724445&r1=1724444&r2=1724445&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFDocFixture.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFDocFixture.java Wed Jan 13
15:59:38 2016
@@ -22,6 +22,8 @@ import org.apache.poi.poifs.filesystem.D
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.POIDataSamples;
 
+import java.io.IOException;
+
 
 public final class HWPFDocFixture
 {
@@ -37,10 +39,7 @@ public final class HWPFDocFixture
     _testFile = testFile;
   }
 
-  public void setUp()
-  {
-    try
-    {
+  public void setUp() throws IOException {
       POIFSFileSystem filesystem = new POIFSFileSystem(
               POIDataSamples.getDocumentInstance().openResourceAsStream(_testFile));
 
@@ -65,11 +64,6 @@ public final class HWPFDocFixture
       filesystem.createDocumentInputStream(name).read(_tableStream);
 
       _fib.fillVariableFields(_mainStream, _tableStream);
-    }
-    catch (Throwable t)
-    {
-      t.printStackTrace();
-    }
   }
 
   public void tearDown()

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestMetaDataIPI.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestMetaDataIPI.java?rev=1724445&r1=1724444&r2=1724445&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestMetaDataIPI.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestMetaDataIPI.java Wed Jan 13 15:59:38
2016
@@ -52,7 +52,7 @@ public final class TestMetaDataIPI exten
 	 * Setup is used to get the document ready. Gets the DocumentSummaryInformation and the
 	 * SummaryInformation to reasonable values
 	 */
-	public void setUp() {
+	public void setUp() throws Exception {
 		bout = new ByteArrayOutputStream();
 		poifs = new POIFSFileSystem();
 		dir = poifs.getRoot();
@@ -72,9 +72,6 @@ public final class TestMetaDataIPI exten
 			 */
 			dsi = PropertySetFactory.newDocumentSummaryInformation();
 			assertNotNull(dsi);
-		} catch (Exception e) {
-			e.printStackTrace();
-			fail();
 		}
 		assertNotNull(dsi);
 		try {
@@ -92,9 +89,6 @@ public final class TestMetaDataIPI exten
 			 */
 			si = PropertySetFactory.newSummaryInformation();
 			assertNotNull(si);
-		} catch (Exception e) {
-			e.printStackTrace();
-			fail();
 		}
 		assertNotNull(dsi);
 	}
@@ -111,13 +105,8 @@ public final class TestMetaDataIPI exten
 
 		si = null;
 		dsi = null;
-		try {
-			poifs.writeFilesystem(bout);
-			bout.flush();
-		} catch (IOException e) {
-			e.printStackTrace();
-			fail();
-		}
+        poifs.writeFilesystem(bout);
+        bout.flush();
 
 		InputStream is = new ByteArrayInputStream(bout.toByteArray());
 		assertNotNull(is);

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java?rev=1724445&r1=1724444&r2=1724445&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java Wed Jan 13 15:59:38 2016
@@ -327,11 +327,7 @@ public class TestWrite
                     }
                     catch (Exception ex)
                     {
-                        ex.printStackTrace();
-                        throw new RuntimeException(ex.toString());
-                        /* FIXME (2): Replace the previous line by the following
-                         * one once we no longer need JDK 1.3 compatibility. */
-                        // throw new RuntimeException(ex);
+                        throw new RuntimeException(ex);
                     }
                 }
             },
@@ -716,7 +712,7 @@ public class TestWrite
 
 
     /**
-     * <p>Performs the check described in {@link #testRecreate()} for a single
+     * <p>Performs the check described in {@link #recreate()} for a single
      * POI filesystem.</p>
      *
      * @param f the POI filesystem to check

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/basic/Util.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/Util.java?rev=1724445&r1=1724444&r2=1724445&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/basic/Util.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/basic/Util.java Wed Jan 13 15:59:38 2016
@@ -152,8 +152,7 @@ final class Util {
                 }
                 catch (IOException ex)
                 {
-                    ex.printStackTrace();
-                    throw new RuntimeException(ex.getMessage());
+                    throw new RuntimeException(ex);
                 }
             }
         };
@@ -224,8 +223,7 @@ final class Util {
                 }
                 catch (Exception ex)
                 {
-                    ex.printStackTrace();
-                    throw new RuntimeException(ex.getMessage());
+                    throw new RuntimeException(ex);
                 }
             }
         };

Modified: poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestRangeEval.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestRangeEval.java?rev=1724445&r1=1724444&r2=1724445&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestRangeEval.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/formula/eval/TestRangeEval.java Wed Jan 13 15:59:38
2016
@@ -24,12 +24,12 @@ import org.apache.poi.hssf.usermodel.HSS
 import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.hssf.util.AreaReference;
-import org.apache.poi.hssf.util.CellReference;
 import org.apache.poi.ss.formula.TwoDEval;
 import org.apache.poi.ss.formula.ptg.AreaI;
 import org.apache.poi.ss.formula.ptg.AreaI.OffsetArea;
 import org.apache.poi.ss.usermodel.CellValue;
+import org.apache.poi.ss.util.AreaReference;
+import org.apache.poi.ss.util.CellReference;
 
 /**
  * Test for unary plus operator evaluator.
@@ -54,7 +54,8 @@ public final class TestRangeEval extends
 			createRefEval(refA),
 			createRefEval(refB),
 		};
-		AreaReference ar = new AreaReference(expectedAreaRef);
+		@SuppressWarnings("deprecation")
+        AreaReference ar = new AreaReference(expectedAreaRef);
 		ValueEval result = EvalInstances.Range.evaluate(args, 0, (short)0);
 		assertTrue(result instanceof AreaEval);
 		AreaEval ae = (AreaEval) result;



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


Mime
View raw message