Permalink
Browse files

Add assertions, remove Sonar warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1568554 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent f8bf663 commit 2b85b00690ec98f3473345acd751a2a05fab3744 @poi-benchmark poi-benchmark committed Feb 15, 2014
View
5 src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java
@@ -51,9 +51,8 @@ public GZIPSheetDataWriter(SharedStringsTable sharedStringsTable) throws IOExcep
* @return temp file to write sheet data
*/
@Override
- public File createTempFile()throws IOException {
- File fd = File.createTempFile("poi-sxssf-sheet-xml", ".gz");
- return fd;
+ public File createTempFile()throws IOException {
+ return File.createTempFile("poi-sxssf-sheet-xml", ".gz");
}
/**
View
3 src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java
@@ -75,8 +75,7 @@ public SheetDataWriter(SharedStringsTable sharedStringsTable) throws IOException
* @return temp file to write sheet data
*/
public File createTempFile()throws IOException {
- File fd = File.createTempFile("poi-sxssf-sheet", ".xml");
- return fd;
+ return File.createTempFile("poi-sxssf-sheet", ".xml");
}
/**
View
18 src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java
@@ -93,14 +93,14 @@ public void existingWorkbook() {
xssfWorkbook.createSheet("S1");
SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook);
xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
- wb.dispose();
+ assertTrue(wb.dispose());
wb = new SXSSFWorkbook(xssfWorkbook);
assertEquals(1, wb.getNumberOfSheets());
Sheet sheet = wb.getSheetAt(0);
assertNotNull(sheet);
assertEquals("S1", sheet.getSheetName());
- wb.dispose();
+ assertTrue(wb.dispose());
}
@@ -151,7 +151,7 @@ public void addToExistingWorkbook() {
cell.setCellValue("value 2_1_1");
SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook);
xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
- wb.dispose();
+ assertTrue(wb.dispose());
wb = new SXSSFWorkbook(xssfWorkbook);
@@ -218,7 +218,7 @@ public void sheetdataWriter(){
File tmp = wr.getTempFile();
assertTrue(tmp.getName().startsWith("poi-sxssf-sheet"));
assertTrue(tmp.getName().endsWith(".xml"));
- wb.dispose();
+ assertTrue(wb.dispose());
wb = new SXSSFWorkbook();
wb.setCompressTempFiles(true);
@@ -228,7 +228,7 @@ public void sheetdataWriter(){
tmp = wr.getTempFile();
assertTrue(tmp.getName().startsWith("poi-sxssf-sheet-xml"));
assertTrue(tmp.getName().endsWith(".gz"));
- wb.dispose();
+ assertTrue(wb.dispose());
//Test escaping of Unicode control characters
wb = new SXSSFWorkbook();
@@ -237,7 +237,7 @@ public void sheetdataWriter(){
Cell cell = xssfWorkbook.getSheet("S1").getRow(0).getCell(0);
assertEquals("value?", cell.getStringCellValue());
- wb.dispose();
+ assertTrue(wb.dispose());
}
@@ -280,7 +280,7 @@ public void gzipSheetdataWriter(){
}
}
- wb.dispose();
+ assertTrue(wb.dispose());
}
@@ -366,10 +366,10 @@ public void bug53515a() throws Exception {
}
wb.write(outSteam);
- // wb.dispose();
+ // assertTrue(wb.dispose());
outSteam.close();
} finally {
- wb.dispose();
+ assertTrue(wb.dispose());
}
}
out.delete();

0 comments on commit 2b85b00

Please sign in to comment.