Fix some IntelliJ warnings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1798913 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c05e2ae644
commit
20f46393f7
@ -57,6 +57,7 @@ import org.apache.poi.util.POILogger;
|
|||||||
import org.apache.poi.util.Removal;
|
import org.apache.poi.util.Removal;
|
||||||
import org.apache.poi.util.TempFile;
|
import org.apache.poi.util.TempFile;
|
||||||
import org.apache.poi.xssf.model.SharedStringsTable;
|
import org.apache.poi.xssf.model.SharedStringsTable;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFChartSheet;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
@ -382,7 +383,8 @@ public class SXSSFWorkbook implements Workbook {
|
|||||||
zos.putNextEntry(new ZipEntry(ze.getName()));
|
zos.putNextEntry(new ZipEntry(ze.getName()));
|
||||||
InputStream is = zipEntrySource.getInputStream(ze);
|
InputStream is = zipEntrySource.getInputStream(ze);
|
||||||
XSSFSheet xSheet=getSheetFromZipEntryName(ze.getName());
|
XSSFSheet xSheet=getSheetFromZipEntryName(ze.getName());
|
||||||
if(xSheet!=null) {
|
// See bug 56557, we should not inject data into the special ChartSheets
|
||||||
|
if(xSheet!=null && !(xSheet instanceof XSSFChartSheet)) {
|
||||||
SXSSFSheet sxSheet=getSXSSFSheet(xSheet);
|
SXSSFSheet sxSheet=getSXSSFSheet(xSheet);
|
||||||
InputStream xis = sxSheet.getWorksheetXMLInputStream();
|
InputStream xis = sxSheet.getWorksheetXMLInputStream();
|
||||||
try {
|
try {
|
||||||
|
@ -577,4 +577,25 @@ public final class TestSXSSFWorkbook extends BaseTestXWorkbook {
|
|||||||
assertEquals(true, s.getRow(0).getCell(0).getBooleanCellValue());
|
assertEquals(true, s.getRow(0).getCell(0).getBooleanCellValue());
|
||||||
assertEquals("Test Row 9", s.getRow(9).getCell(2).getStringCellValue());
|
assertEquals("Test Row 9", s.getRow(9).getCell(2).getStringCellValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test56557() throws IOException, InvalidFormatException {
|
||||||
|
Workbook wb = WorkbookFactory.create(XSSFTestDataSamples.getSampleFile("56557.xlsx"));
|
||||||
|
|
||||||
|
// Using streaming XSSFWorkbook makes the output file invalid
|
||||||
|
wb = new SXSSFWorkbook(((XSSFWorkbook) wb));
|
||||||
|
|
||||||
|
Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb);
|
||||||
|
assertNotNull(wbBack);
|
||||||
|
wbBack.close();
|
||||||
|
|
||||||
|
/*FileOutputStream out = new FileOutputStream("C:/temp/out.xlsx");
|
||||||
|
try {
|
||||||
|
wb.write(out);
|
||||||
|
} finally {
|
||||||
|
out.close();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
wb.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user