diff options
author | Dominik Stadler <centic@apache.org> | 2015-04-03 15:55:21 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2015-04-03 15:55:21 +0000 |
commit | 690abbe5547df702ce83cf2fe63a3bc4c00f1df6 (patch) | |
tree | 64cfa6d626bea40dbc7f9b39be6d25e0f86ba501 /src/testcases/org/apache/poi/hssf | |
parent | 563cab96816fb36879b2f3df4fe2e0ce17457e58 (diff) | |
download | poi-690abbe5547df702ce83cf2fe63a3bc4c00f1df6.tar.gz poi-690abbe5547df702ce83cf2fe63a3bc4c00f1df6.zip |
Bug 56579: Throw exception if max string length of 32767 chars is exceeded in XSSF and SXSSF.
Add verification testcase for bug 57008.
Move some unit tests to the Bsae-Test-Class to verify things for all SS-implementations.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1671096 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java index 066c12e7f1..7c78fb0674 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java @@ -30,7 +30,6 @@ import org.apache.poi.hssf.record.DBCellRecord; import org.apache.poi.hssf.record.FormulaRecord; import org.apache.poi.hssf.record.Record; import org.apache.poi.hssf.record.StringRecord; -import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.usermodel.BaseTestCell; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.FormulaError; @@ -355,38 +354,6 @@ public final class TestHSSFCell extends BaseTestCell { assertEquals(DBCellRecord.class, dbcr.getClass()); } - /** - * The maximum length of cell contents (text) is 32,767 characters. - * @throws IOException - */ - public void testMaxTextLength() throws IOException{ - HSSFWorkbook wb = new HSSFWorkbook(); - HSSFSheet sheet = wb.createSheet(); - HSSFCell cell = sheet.createRow(0).createCell(0); - - int maxlen = SpreadsheetVersion.EXCEL97.getMaxTextLength(); - assertEquals(32767, maxlen); - - StringBuffer b = new StringBuffer() ; - - // 32767 is okay - for( int i = 0 ; i < maxlen ; i++ ) - { - b.append( "X" ) ; - } - cell.setCellValue(b.toString()); - - b.append("X"); - // 32768 produces an invalid XLS file - try { - cell.setCellValue(b.toString()); - fail("Expected exception"); - } catch (IllegalArgumentException e){ - assertEquals("The maximum length of cell contents (text) is 32,767 characters", e.getMessage()); - } - wb.close(); - } - /** * HSSF prior to version 3.7 had a bug: it could write a NaN but could not read such a file back. */ |