]> source.dussan.org Git - poi.git/commitdiff
cleanup for r1812470: avoid NPEs from string.isEmpty()
authorJaven O'Neal <onealj@apache.org>
Wed, 18 Oct 2017 14:40:56 +0000 (14:40 +0000)
committerJaven O'Neal <onealj@apache.org>
Wed, 18 Oct 2017 14:40:56 +0000 (14:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1812532 13f79535-47bb-0310-9956-ffa450edef68

src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java

index 34842a5bd32ca95b80af9bf22ec00a5e99974264..d66ef833978ad7546a51588a0d0329c1ad6073b3 100644 (file)
@@ -478,7 +478,7 @@ public class ToHtml {
                         CellFormat cf = CellFormat.getInstance(
                                 style.getDataFormatString());
                         CellFormatResult result = cf.apply(cell);
-                        content = result.text;
+                        content = result.text; //never null
                         if (content.isEmpty()) {
                             content = "&nbsp;";
                         }
index 8ceec105e21a0d7534e289a3c92458a9af4b870e..f19f1ac5626476174e8f3685a25a4e08e310b009 100644 (file)
@@ -169,8 +169,8 @@ public abstract class BaseTestCellComment {
             assertNotNull("Cells in the second column have comments", sheet.getCellComment(new CellAddress(rownum, 1)));
 
             assertEquals("Yegor Kozlov", comment.getAuthor());
-            assertFalse("cells in the second column have not empyy notes",
-                    comment.getString().getString().isEmpty());
+            assertTrue("cells in the second column should have non-empty notes",
+                    !comment.getString().getString().isEmpty());
             assertEquals(rownum, comment.getRow());
             assertEquals(cell.getColumnIndex(), comment.getColumn());
         }