Bug 58829: Remove some useages of printStackTrace() and some other minor cleanups
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1724445 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8cf781c31b
commit
8793846bc6
@ -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;
|
||||
|
@ -38,17 +38,23 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalAlignRun
|
||||
/**
|
||||
* 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");
|
||||
ctRun.addNewT().setStringValue("TEST2 STRING");
|
||||
@ -410,6 +416,13 @@ public class TestXWPFRun extends TestCase {
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,6 +22,8 @@ import org.apache.poi.poifs.filesystem.DocumentEntry;
|
||||
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()
|
||||
|
@ -52,7 +52,7 @@ public final class TestMetaDataIPI extends TestCase{
|
||||
* 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 extends TestCase{
|
||||
*/
|
||||
dsi = PropertySetFactory.newDocumentSummaryInformation();
|
||||
assertNotNull(dsi);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
assertNotNull(dsi);
|
||||
try {
|
||||
@ -92,9 +89,6 @@ public final class TestMetaDataIPI extends TestCase{
|
||||
*/
|
||||
si = PropertySetFactory.newSummaryInformation();
|
||||
assertNotNull(si);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
assertNotNull(dsi);
|
||||
}
|
||||
@ -111,13 +105,8 @@ public final class TestMetaDataIPI extends TestCase{
|
||||
|
||||
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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -24,12 +24,12 @@ import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
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 TestCase {
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user