mirror of https://github.com/apache/poi.git
Update some tests and IntelliJ warnings
Ignore disabled test instead of not listing it in the test-report at all git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1819768 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a3ddc94776
commit
dc621da629
|
@ -483,12 +483,10 @@ public final class BiffViewer {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
private static String formatRecordDetails(int globalOffset, int sid, int size, int recordCounter) {
|
private static String formatRecordDetails(int globalOffset, int sid, int size, int recordCounter) {
|
||||||
StringBuilder sb = new StringBuilder(64);
|
return "Offset=" + HexDump.intToHex(globalOffset) + "(" + globalOffset + ")" +
|
||||||
sb.append("Offset=").append(HexDump.intToHex(globalOffset)).append("(").append(globalOffset).append(")");
|
" recno=" + recordCounter +
|
||||||
sb.append(" recno=").append(recordCounter);
|
" sid=" + HexDump.shortToHex(sid) +
|
||||||
sb.append( " sid=").append(HexDump.shortToHex(sid));
|
" size=" + HexDump.shortToHex(size) + "(" + size + ")";
|
||||||
sb.append( " size=").append(HexDump.shortToHex(size)).append("(").append(size).append(")");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import org.apache.poi.ss.util.CellRangeAddressBase;
|
import org.apache.poi.ss.util.CellRangeAddressBase;
|
||||||
import org.apache.poi.ss.util.CellReference;
|
import org.apache.poi.ss.util.CellReference;
|
||||||
import org.apache.poi.ss.util.SheetUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates Conditional Formatting constraints.<p>
|
* Evaluates Conditional Formatting constraints.<p>
|
||||||
|
@ -103,7 +102,7 @@ public class ConditionalFormattingEvaluator {
|
||||||
/**
|
/**
|
||||||
* lazy load by sheet since reading can be expensive
|
* lazy load by sheet since reading can be expensive
|
||||||
*
|
*
|
||||||
* @param sheet
|
* @param sheet The sheet to look at
|
||||||
* @return unmodifiable list of rules
|
* @return unmodifiable list of rules
|
||||||
*/
|
*/
|
||||||
protected List<EvaluationConditionalFormatRule> getRules(Sheet sheet) {
|
protected List<EvaluationConditionalFormatRule> getRules(Sheet sheet) {
|
||||||
|
@ -156,9 +155,12 @@ public class ConditionalFormattingEvaluator {
|
||||||
// compute and cache them
|
// compute and cache them
|
||||||
rules = new ArrayList<>();
|
rules = new ArrayList<>();
|
||||||
|
|
||||||
Sheet sheet = null;
|
final Sheet sheet;
|
||||||
if (cellRef.getSheetName() != null) sheet = workbook.getSheet(cellRef.getSheetName());
|
if (cellRef.getSheetName() != null) {
|
||||||
else sheet = workbook.getSheetAt(workbook.getActiveSheetIndex());
|
sheet = workbook.getSheet(cellRef.getSheetName());
|
||||||
|
} else {
|
||||||
|
sheet = workbook.getSheetAt(workbook.getActiveSheetIndex());
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Per Excel help:
|
* Per Excel help:
|
||||||
|
@ -197,7 +199,7 @@ public class ConditionalFormattingEvaluator {
|
||||||
* formula by the relative position of the current cell, or the wrong value is checked.
|
* formula by the relative position of the current cell, or the wrong value is checked.
|
||||||
* This is handled by {@link WorkbookEvaluator#evaluate(String, CellReference, CellRangeAddressBase)}.
|
* This is handled by {@link WorkbookEvaluator#evaluate(String, CellReference, CellRangeAddressBase)}.
|
||||||
*
|
*
|
||||||
* @param cell
|
* @param cell The cell to look for
|
||||||
* @return Unmodifiable List of {@link EvaluationConditionalFormatRule}s that apply to the current cell value,
|
* @return Unmodifiable List of {@link EvaluationConditionalFormatRule}s that apply to the current cell value,
|
||||||
* in priority order, as evaluated by Excel (smallest priority # for XSSF, definition order for HSSF),
|
* in priority order, as evaluated by Excel (smallest priority # for XSSF, definition order for HSSF),
|
||||||
* or null if none apply
|
* or null if none apply
|
||||||
|
@ -211,7 +213,9 @@ public class ConditionalFormattingEvaluator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sheetName
|
* Retrieve all formatting rules for the sheet with the given name.
|
||||||
|
*
|
||||||
|
* @param sheetName The name of the sheet to look at
|
||||||
* @return unmodifiable list of all Conditional format rules for the given sheet, if any
|
* @return unmodifiable list of all Conditional format rules for the given sheet, if any
|
||||||
*/
|
*/
|
||||||
public List<EvaluationConditionalFormatRule> getFormatRulesForSheet(String sheetName) {
|
public List<EvaluationConditionalFormatRule> getFormatRulesForSheet(String sheetName) {
|
||||||
|
@ -219,7 +223,9 @@ public class ConditionalFormattingEvaluator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sheet
|
* Retrieve all formatting rules for the given sheet.
|
||||||
|
*
|
||||||
|
* @param sheet The sheet to look at
|
||||||
* @return unmodifiable list of all Conditional format rules for the given sheet, if any
|
* @return unmodifiable list of all Conditional format rules for the given sheet, if any
|
||||||
*/
|
*/
|
||||||
public List<EvaluationConditionalFormatRule> getFormatRulesForSheet(Sheet sheet) {
|
public List<EvaluationConditionalFormatRule> getFormatRulesForSheet(Sheet sheet) {
|
||||||
|
@ -247,8 +253,9 @@ public class ConditionalFormattingEvaluator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Retrieve all cells where the given formatting rule evaluates to true.
|
||||||
*
|
*
|
||||||
* @param rule
|
* @param rule The rule to look at
|
||||||
* @return unmodifiable List of all cells in the rule's region matching the rule's condition
|
* @return unmodifiable List of all cells in the rule's region matching the rule's condition
|
||||||
*/
|
*/
|
||||||
public List<Cell> getMatchingCells(EvaluationConditionalFormatRule rule) {
|
public List<Cell> getMatchingCells(EvaluationConditionalFormatRule rule) {
|
||||||
|
|
|
@ -376,7 +376,7 @@ public class SXSSFSheet implements Sheet
|
||||||
return _sh.getColumnStyle(column);
|
return _sh.getColumnStyle(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Sets the CellStyle that applies to the given
|
* Sets the CellStyle that applies to the given
|
||||||
* (0 based) column.
|
* (0 based) column.
|
||||||
*/
|
*/
|
||||||
|
@ -1131,8 +1131,8 @@ public class SXSSFSheet implements Sheet
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if there is a page break at the indicated row
|
* Determines if there is a page break at the indicated row
|
||||||
* @param row FIXME: Document this!
|
* @param row The row to check
|
||||||
* @return FIXME: Document this!
|
* @return true if there is a page-break at the given row, false otherwise
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isRowBroken(int row)
|
public boolean isRowBroken(int row)
|
||||||
|
@ -1142,7 +1142,7 @@ public class SXSSFSheet implements Sheet
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the page break at the indicated row
|
* Removes the page break at the indicated row
|
||||||
* @param row
|
* @param row The row to remove page breaks from
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeRowBreak(int row)
|
public void removeRowBreak(int row)
|
||||||
|
@ -1172,7 +1172,7 @@ public class SXSSFSheet implements Sheet
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a page break at the indicated column
|
* Sets a page break at the indicated column
|
||||||
* @param column
|
* @param column The column to work on
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setColumnBreak(int column)
|
public void setColumnBreak(int column)
|
||||||
|
@ -1182,8 +1182,8 @@ public class SXSSFSheet implements Sheet
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if there is a page break at the indicated column
|
* Determines if there is a page break at the indicated column
|
||||||
* @param column FIXME: Document this!
|
* @param column The column to check for page breaks
|
||||||
* @return FIXME: Document this!
|
* @return true if there is a page break at the given column, false otherwise
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isColumnBroken(int column)
|
public boolean isColumnBroken(int column)
|
||||||
|
@ -1193,7 +1193,7 @@ public class SXSSFSheet implements Sheet
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a page break at the indicated column
|
* Removes a page break at the indicated column
|
||||||
* @param column
|
* @param column The column to remove a page break from
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeColumnBreak(int column)
|
public void removeColumnBreak(int column)
|
||||||
|
@ -1366,7 +1366,7 @@ public class SXSSFSheet implements Sheet
|
||||||
int startRow = findStartOfRowOutlineGroup(rowIndex);
|
int startRow = findStartOfRowOutlineGroup(rowIndex);
|
||||||
|
|
||||||
// Hide all the columns until the end of the group
|
// Hide all the columns until the end of the group
|
||||||
int lastRow = writeHidden(row, startRow, true);
|
int lastRow = writeHidden(row, startRow);
|
||||||
SXSSFRow lastRowObj = getRow(lastRow);
|
SXSSFRow lastRowObj = getRow(lastRow);
|
||||||
if (lastRowObj != null) {
|
if (lastRowObj != null) {
|
||||||
lastRowObj.setCollapsed(true);
|
lastRowObj.setCollapsed(true);
|
||||||
|
@ -1397,12 +1397,12 @@ public class SXSSFSheet implements Sheet
|
||||||
return currentRow + 1;
|
return currentRow + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int writeHidden(SXSSFRow xRow, int rowIndex, boolean hidden) {
|
private int writeHidden(SXSSFRow xRow, int rowIndex) {
|
||||||
int level = xRow.getOutlineLevel();
|
int level = xRow.getOutlineLevel();
|
||||||
SXSSFRow currRow = getRow(rowIndex);
|
SXSSFRow currRow = getRow(rowIndex);
|
||||||
|
|
||||||
while (currRow != null && currRow.getOutlineLevel() >= level) {
|
while (currRow != null && currRow.getOutlineLevel() >= level) {
|
||||||
currRow.setHidden(hidden);
|
currRow.setHidden(true);
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
currRow = getRow(rowIndex);
|
currRow = getRow(rowIndex);
|
||||||
}
|
}
|
||||||
|
@ -1637,8 +1637,8 @@ public class SXSSFSheet implements Sheet
|
||||||
/**
|
/**
|
||||||
* Get a Hyperlink in this sheet anchored at row, column
|
* Get a Hyperlink in this sheet anchored at row, column
|
||||||
*
|
*
|
||||||
* @param row
|
* @param row The 0-base row number
|
||||||
* @param column
|
* @param column The 0-based column number
|
||||||
* @return hyperlink if there is a hyperlink anchored at row, column; otherwise returns null
|
* @return hyperlink if there is a hyperlink anchored at row, column; otherwise returns null
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1860,7 +1860,7 @@ public class SXSSFSheet implements Sheet
|
||||||
/**
|
/**
|
||||||
* Flush all rows to disk. After this call no rows can be accessed via getRow()
|
* Flush all rows to disk. After this call no rows can be accessed via getRow()
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException If an I/O error occurs
|
||||||
*/
|
*/
|
||||||
public void flushRows() throws IOException
|
public void flushRows() throws IOException
|
||||||
{
|
{
|
||||||
|
@ -1889,13 +1889,12 @@ public class SXSSFSheet implements Sheet
|
||||||
|
|
||||||
public int getRowNum(SXSSFRow row)
|
public int getRowNum(SXSSFRow row)
|
||||||
{
|
{
|
||||||
for(Iterator<Map.Entry<Integer,SXSSFRow>> iter=_rows.entrySet().iterator();iter.hasNext();)
|
for (Map.Entry<Integer, SXSSFRow> entry : _rows.entrySet()) {
|
||||||
{
|
if (entry.getValue() == row) {
|
||||||
Map.Entry<Integer,SXSSFRow> entry=iter.next();
|
|
||||||
if(entry.getValue()==row) {
|
|
||||||
return entry.getKey().intValue();
|
return entry.getKey().intValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -905,8 +905,7 @@ public class SXSSFWorkbook implements Workbook {
|
||||||
* @exception IOException if anything can't be written.
|
* @exception IOException if anything can't be written.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void write(OutputStream stream) throws IOException
|
public void write(OutputStream stream) throws IOException {
|
||||||
{
|
|
||||||
flushSheets();
|
flushSheets();
|
||||||
|
|
||||||
//Save the template
|
//Save the template
|
||||||
|
|
|
@ -191,6 +191,8 @@ public class SheetDataWriter implements Closeable {
|
||||||
*
|
*
|
||||||
* @param rownum 0-based row number
|
* @param rownum 0-based row number
|
||||||
* @param row a row
|
* @param row a row
|
||||||
|
*
|
||||||
|
* @throws IOException If an I/O error occurs
|
||||||
*/
|
*/
|
||||||
public void writeRow(int rownum, SXSSFRow row) throws IOException {
|
public void writeRow(int rownum, SXSSFRow row) throws IOException {
|
||||||
if (_numberOfFlushedRows == 0)
|
if (_numberOfFlushedRows == 0)
|
||||||
|
|
|
@ -3851,7 +3851,6 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CellRange<XSSFCell> setArrayFormula(String formula, CellRangeAddress range) {
|
public CellRange<XSSFCell> setArrayFormula(String formula, CellRangeAddress range) {
|
||||||
|
|
||||||
CellRange<XSSFCell> cr = getCellRange(range);
|
CellRange<XSSFCell> cr = getCellRange(range);
|
||||||
|
|
||||||
XSSFCell mainArrayFormulaCell = cr.getTopLeftCell();
|
XSSFCell mainArrayFormulaCell = cr.getTopLeftCell();
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.apache.poi.xwpf.XWPFTestDataSamples;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -229,7 +230,8 @@ public final class TestPOIXMLProperties {
|
||||||
return utcString.equals(dateTimeUtcString);
|
return utcString.equals(dateTimeUtcString);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
@Ignore("Fails to add some of the thumbnails, needs more investigation")
|
||||||
|
@Test
|
||||||
public void testThumbnails() throws Exception {
|
public void testThumbnails() throws Exception {
|
||||||
POIXMLProperties noThumbProps = sampleNoThumb.getProperties();
|
POIXMLProperties noThumbProps = sampleNoThumb.getProperties();
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,8 @@ public class XWPFTestDataSamples {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] getImage(String filename) throws IOException {
|
public static byte[] getImage(String filename) throws IOException {
|
||||||
InputStream is = POIDataSamples.getDocumentInstance().openResourceAsStream(filename);
|
try (InputStream is = POIDataSamples.getDocumentInstance().openResourceAsStream(filename)) {
|
||||||
try {
|
|
||||||
return IOUtils.toByteArray(is);
|
return IOUtils.toByteArray(is);
|
||||||
} finally {
|
|
||||||
is.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,18 +33,16 @@ public abstract class HMEFTest extends TestCase {
|
||||||
assertEquals(filename, attachment.getLongFilename());
|
assertEquals(filename, attachment.getLongFilename());
|
||||||
assertContents(filename, attachment.getContents());
|
assertContents(filename, attachment.getContents());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertContents(String filename, byte[] actual)
|
protected void assertContents(String filename, byte[] actual)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
InputStream stream = _samples.openResourceAsStream("quick-contents/" + filename);
|
try (InputStream stream = _samples.openResourceAsStream("quick-contents/" + filename)) {
|
||||||
try {
|
byte[] expected = IOUtils.toByteArray(stream);
|
||||||
byte[] expected = IOUtils.toByteArray(stream);
|
|
||||||
|
assertEquals(expected.length, actual.length);
|
||||||
assertEquals(expected.length, actual.length);
|
for (int i = 0; i < expected.length; i++) {
|
||||||
for(int i=0; i<expected.length; i++) {
|
assertEquals("Byte " + i + " wrong", expected[i], actual[i]);
|
||||||
assertEquals("Byte " + i + " wrong", expected[i], actual[i]);
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
stream.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
package org.apache.poi.hmef.extractor;
|
package org.apache.poi.hmef.extractor;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
import static org.junit.Assert.assertArrayEquals;
|
||||||
|
|
||||||
|
@ -37,7 +39,7 @@ public class TestHMEFContentsExtractor {
|
||||||
File outputDirectory = TempFile.createTempDirectory("quick-winmail-main");
|
File outputDirectory = TempFile.createTempDirectory("quick-winmail-main");
|
||||||
String[] args = new String[] { message.getAbsolutePath(), outputDirectory.getAbsolutePath() };
|
String[] args = new String[] { message.getAbsolutePath(), outputDirectory.getAbsolutePath() };
|
||||||
HMEFContentsExtractor.main(args);
|
HMEFContentsExtractor.main(args);
|
||||||
|
|
||||||
String[] contents = new String[] {
|
String[] contents = new String[] {
|
||||||
"message.rtf", // from extractMessageBody
|
"message.rtf", // from extractMessageBody
|
||||||
"quick.txt", "quick.pdf", "quick.xml", "quick.doc", "quick.html" // from extractAttachments
|
"quick.txt", "quick.pdf", "quick.xml", "quick.doc", "quick.html" // from extractAttachments
|
||||||
|
@ -46,11 +48,15 @@ public class TestHMEFContentsExtractor {
|
||||||
for (String filename : contents) {
|
for (String filename : contents) {
|
||||||
File f = new File(outputDirectory, filename);
|
File f = new File(outputDirectory, filename);
|
||||||
assertTrue(f + " does not exist", f.exists());
|
assertTrue(f + " does not exist", f.exists());
|
||||||
|
assertTrue(f.delete());
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDirectory.delete();
|
String[] list = outputDirectory.list();
|
||||||
|
assertNotNull(list);
|
||||||
|
assertEquals( "Had: " + Arrays.toString(list), 0, list.length);
|
||||||
|
assertTrue(outputDirectory.delete());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void TestExtractMessageBody_OutputStream() throws IOException {
|
public void TestExtractMessageBody_OutputStream() throws IOException {
|
||||||
POIDataSamples samples = POIDataSamples.getHMEFInstance();
|
POIDataSamples samples = POIDataSamples.getHMEFInstance();
|
||||||
|
@ -64,7 +70,7 @@ public class TestHMEFContentsExtractor {
|
||||||
assertArrayEquals("RTF magic number", expectedMagic, magic);
|
assertArrayEquals("RTF magic number", expectedMagic, magic);
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void TestExtractMessageBody_File() throws IOException {
|
public void TestExtractMessageBody_File() throws IOException {
|
||||||
POIDataSamples samples = POIDataSamples.getHMEFInstance();
|
POIDataSamples samples = POIDataSamples.getHMEFInstance();
|
||||||
|
|
|
@ -101,12 +101,9 @@ public final class TestNPOIFSFileSystem {
|
||||||
|
|
||||||
protected static NPOIFSFileSystem writeOutFileAndReadBack(NPOIFSFileSystem original) throws IOException {
|
protected static NPOIFSFileSystem writeOutFileAndReadBack(NPOIFSFileSystem original) throws IOException {
|
||||||
final File file = TempFile.createTempFile("TestPOIFS", ".ole2");
|
final File file = TempFile.createTempFile("TestPOIFS", ".ole2");
|
||||||
final OutputStream fout = new FileOutputStream(file);
|
try (OutputStream fout = new FileOutputStream(file)) {
|
||||||
try {
|
original.writeFilesystem(fout);
|
||||||
original.writeFilesystem(fout);
|
}
|
||||||
} finally {
|
|
||||||
fout.close();
|
|
||||||
}
|
|
||||||
return new NPOIFSFileSystem(file, false);
|
return new NPOIFSFileSystem(file, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1717,26 +1714,20 @@ public final class TestNPOIFSFileSystem {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
for (int i = 0; i < iterations; i++) {
|
for (int i = 0; i < iterations; i++) {
|
||||||
InputStream inputStream = POIDataSamples.getHSMFInstance().openResourceAsStream("lots-of-recipients.msg");
|
try (InputStream inputStream = POIDataSamples.getHSMFInstance().openResourceAsStream("lots-of-recipients.msg")) {
|
||||||
try {
|
|
||||||
OPOIFSFileSystem srcFileSystem = new OPOIFSFileSystem(inputStream);
|
OPOIFSFileSystem srcFileSystem = new OPOIFSFileSystem(inputStream);
|
||||||
OPOIFSFileSystem destFileSystem = new OPOIFSFileSystem();
|
OPOIFSFileSystem destFileSystem = new OPOIFSFileSystem();
|
||||||
|
|
||||||
copyAllEntries(srcFileSystem.getRoot(), destFileSystem.getRoot());
|
copyAllEntries(srcFileSystem.getRoot(), destFileSystem.getRoot());
|
||||||
|
|
||||||
File file = File.createTempFile("opoi", ".dat");
|
File file = File.createTempFile("opoi", ".dat");
|
||||||
OutputStream outputStream = new FileOutputStream(file);
|
try (OutputStream outputStream = new FileOutputStream(file)) {
|
||||||
try {
|
|
||||||
destFileSystem.writeFilesystem(outputStream);
|
destFileSystem.writeFilesystem(outputStream);
|
||||||
} finally {
|
|
||||||
outputStream.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assertTrue(file.delete());
|
assertTrue(file.delete());
|
||||||
if (i % 10 == 0) System.out.print(".");
|
if (i % 10 == 0) System.out.print(".");
|
||||||
if (i % 800 == 0 && i > 0) System.out.println();
|
if (i % 800 == 0 && i > 0) System.out.println();
|
||||||
} finally {
|
|
||||||
inputStream.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1750,26 +1741,20 @@ public final class TestNPOIFSFileSystem {
|
||||||
|
|
||||||
for (int i = 0; i < iterations; i++) {
|
for (int i = 0; i < iterations; i++) {
|
||||||
|
|
||||||
InputStream inputStream = POIDataSamples.getHSMFInstance().openResourceAsStream("lots-of-recipients.msg");
|
try (InputStream inputStream = POIDataSamples.getHSMFInstance().openResourceAsStream("lots-of-recipients.msg")) {
|
||||||
try {
|
|
||||||
NPOIFSFileSystem srcFileSystem = new NPOIFSFileSystem(inputStream);
|
NPOIFSFileSystem srcFileSystem = new NPOIFSFileSystem(inputStream);
|
||||||
NPOIFSFileSystem destFileSystem = new NPOIFSFileSystem();
|
NPOIFSFileSystem destFileSystem = new NPOIFSFileSystem();
|
||||||
|
|
||||||
copyAllEntries(srcFileSystem.getRoot(), destFileSystem.getRoot());
|
copyAllEntries(srcFileSystem.getRoot(), destFileSystem.getRoot());
|
||||||
|
|
||||||
File file = File.createTempFile("npoi", ".dat");
|
File file = File.createTempFile("npoi", ".dat");
|
||||||
OutputStream outputStream = new FileOutputStream(file);
|
try (OutputStream outputStream = new FileOutputStream(file)) {
|
||||||
try {
|
|
||||||
destFileSystem.writeFilesystem(outputStream);
|
destFileSystem.writeFilesystem(outputStream);
|
||||||
} finally {
|
|
||||||
outputStream.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assertTrue(file.delete());
|
assertTrue(file.delete());
|
||||||
if (i % 10 == 0) System.out.print(".");
|
if (i % 10 == 0) System.out.print(".");
|
||||||
if (i % 800 == 0 && i > 0) System.out.println();
|
if (i % 800 == 0 && i > 0) System.out.println();
|
||||||
} finally {
|
|
||||||
inputStream.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1793,11 +1778,8 @@ public final class TestNPOIFSFileSystem {
|
||||||
} else {
|
} else {
|
||||||
DocumentEntry srcEntry = (DocumentEntry) entry;
|
DocumentEntry srcEntry = (DocumentEntry) entry;
|
||||||
|
|
||||||
InputStream inputStream = new DocumentInputStream(srcEntry);
|
try (InputStream inputStream = new DocumentInputStream(srcEntry)) {
|
||||||
try {
|
|
||||||
destDirectory.createDocument(entry.getName(), inputStream);
|
destDirectory.createDocument(entry.getName(), inputStream);
|
||||||
} finally {
|
|
||||||
inputStream.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -576,8 +576,8 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
|
||||||
*/
|
*/
|
||||||
workbook.close();
|
workbook.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
@Ignore("See bug 59728")
|
||||||
@Test
|
@Test
|
||||||
public void shouldNotBeAbleToCreateArrayFormulaOnPreexistingMergedRegion() throws IOException {
|
public void shouldNotBeAbleToCreateArrayFormulaOnPreexistingMergedRegion() throws IOException {
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue