You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2015/10/27 11:40:30 UTC

[Bug 58558] New: NPE in SXSSFCell.setCellValue(RichTextString) when passing 'null' as parameter

https://bz.apache.org/bugzilla/show_bug.cgi?id=58558

            Bug ID: 58558
           Summary: NPE in SXSSFCell.setCellValue(RichTextString) when
                    passing 'null' as parameter
           Product: POI
           Version: 3.12-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SXSSF
          Assignee: dev@poi.apache.org
          Reporter: barney2k7@gmail.com

If SXSSFCell.setCellValue(RichTextString) is called with 'null' as parameter,
an NPE is thrown:

java.lang.NullPointerException
    at
org.apache.poi.xssf.usermodel.XSSFRichTextString.length(XSSFRichTextString.java:328)
    at org.apache.poi.xssf.streaming.SXSSFCell.setCellValue(SXSSFCell.java:232)
    at ...

This seems to be a bug, as the javadoc of that method clearly states "If value
is null then we will change the cell to a Blank cell."

Other Cell implementations (e.g. XSSFCell) correctly implement what javadoc
promises.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58558] NPE in SXSSFCell.setCellValue(RichTextString) when passing 'null' as parameter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58558

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEEDINFO

--- Comment #3 from Nick Burch <ap...@gagravarr.org> ---
Any chance you could write a short junit unit test that shows the problem still
occurring? We can then use that to verify the fix, when done, and also to
ensure that it doesn't get broken in the future

Also, missing versions added to bugzilla, thanks for reminding us!

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58558] NPE in SXSSFCell.setCellValue(RichTextString) when passing 'null' as parameter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58558

barney2k7@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|3.12-FINAL                  |3.13-FINAL
             Status|NEEDINFO                    |NEW

--- Comment #4 from barney2k7@gmail.com ---
Here's a test case that you can add to
org.apache.poi.ss.usermodel.BaseTestCell:

  /**
   * Test case for 58558
   */
  @Test
  public void testSetCellValueNullRichTextString() throws IOException {
    Workbook wb = _testDataProvider.createWorkbook();
    Sheet sheet = wb.createSheet();
    Cell cell = sheet.createRow(0).createCell(0);

    RichTextString str = null;
    cell.setCellValue(str);
    assertEquals("", cell.getStringCellValue());

    wb.close();
  }


It fails with NPE for SXSSF, but works fine for XSSF and HSSF (all using poi
3.13 final release)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58558] NPE in SXSSFCell.setCellValue(RichTextString) when passing 'null' as parameter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58558

barney2k7@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WORKSFORME                  |---
             Status|RESOLVED                    |REOPENED

--- Comment #2 from barney2k7@gmail.com ---
This is not a duplicate of Bug 58113: 

SXSSFCell.setCellValue(RichTextString) is still broken in 3.13

Bug 58113 only fixed SXSSFCell.setCellValue(String)


PS: 3.13-FINAL isn't available in the Version Field of Bugzilla, you might want
to add that

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58558] NPE in SXSSFCell.setCellValue(RichTextString) when passing 'null' as parameter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58558

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
         Resolution|---                         |WORKSFORME
             Status|NEW                         |RESOLVED

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
This is fixed in POI 3.13 via Bug 58113 already, please update and try again.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 58558] NPE in SXSSFCell.setCellValue(RichTextString) when passing 'null' as parameter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58558

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Nick Burch <ap...@gagravarr.org> ---
Thanks for that. Fuller test case and a SXSSF fix added in r1711082.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org