fix some Eclipse warnings, unnecessary null-check and missing close() in tests

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1594201 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2014-05-13 11:31:18 +00:00
parent 0bcdc868f3
commit 599489e6fa
2 changed files with 62 additions and 59 deletions

View File

@ -70,6 +70,7 @@ public class ExtractorFactory {
/** Should this thread prefer event based over usermodel based extractors? */
private static final ThreadLocal<Boolean> threadPreferEventExtractors = new ThreadLocal<Boolean>() {
@Override
protected Boolean initialValue() { return Boolean.FALSE; }
};
/** Should all threads prefer event based over usermodel based extractors? */
@ -168,9 +169,9 @@ public class ExtractorFactory {
if(corePart.getContentType().equals(rel.getContentType())) {
if(getPreferEventExtractor()) {
return new XSSFEventBasedExcelExtractor(pkg);
} else {
return new XSSFExcelExtractor(pkg);
}
return new XSSFExcelExtractor(pkg);
}
}
@ -317,10 +318,7 @@ public class ExtractorFactory {
}
// Create the extractors
if(
(dirs == null || dirs.size() == 0) &&
(nonPOIFS == null || nonPOIFS.size() == 0)
){
if(dirs.size() == 0 && nonPOIFS.size() == 0){
return new POITextExtractor[0];
}

View File

@ -636,8 +636,9 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
@Test
public void writeWorkbookFromNPOIFS() throws IOException {
InputStream is = HSSFTestDataSamples.openSampleFileStream("WithEmbeddedObjects.xls");
try {
NPOIFSFileSystem fs = new NPOIFSFileSystem(is);
try {
// Start as NPOIFS
HSSFWorkbook wb = new HSSFWorkbook(fs.getRoot(), true);
assertEquals(3, wb.getNumberOfSheets());
@ -647,9 +648,13 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
assertEquals(3, wb.getNumberOfSheets());
assertEquals("Root xls", wb.getSheetAt(0).getRow(0).getCell(0).getStringCellValue());
} finally {
fs.close();
}
} finally {
is.close();
}
}
@Test
public void cellStylesLimit() {