diff options
author | Nick Burch <nick@apache.org> | 2016-02-11 15:13:40 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2016-02-11 15:13:40 +0000 |
commit | 6f46cd95be3ab90a8b85f839e399761c6d637baf (patch) | |
tree | 3a8e9f952988c68a4264af74f1d085e78bd03222 /src/testcases/org/apache/poi/ss/usermodel | |
parent | f597a1717ce7dda81a57b575f62f9d381a4b80d2 (diff) | |
download | poi-6f46cd95be3ab90a8b85f839e399761c6d637baf.tar.gz poi-6f46cd95be3ab90a8b85f839e399761c6d637baf.zip |
Fix #57034 on SXSSF, and add a common unit test to show it was already fixed on the others + is now fixed for SXSSF
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1729849 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss/usermodel')
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java index 38c2f5ca10..013e41b5f9 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java @@ -1380,4 +1380,27 @@ public abstract class BaseTestBugzillaIssues { wb.close(); } + + /** + * If someone sets a null string as a cell value, treat + * it as an empty cell, and avoid a NPE on auto-sizing + */ + @Test + public void test57034() throws Exception { + Workbook wb = _testDataProvider.createWorkbook(); + Sheet s = wb.createSheet(); + Cell cell = s.createRow(0).createCell(0); + cell.setCellValue((String)null); + assertEquals(Cell.CELL_TYPE_BLANK, cell.getCellType()); + + _testDataProvider.trackColumnsForAutosizing(s, 0); + + s.autoSizeColumn(0); + assertEquals(2048, s.getColumnWidth(0)); + + s.autoSizeColumn(0, true); + assertEquals(2048, s.getColumnWidth(0)); + + wb.close(); + } } |