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 2009/07/08 04:31:32 UTC

DO NOT REPLY [Bug 47493] New: HSSFCell.setCellValue(String value) & HSSFRichTextString

https://issues.apache.org/bugzilla/show_bug.cgi?id=47493

           Summary: HSSFCell.setCellValue(String value) &
                    HSSFRichTextString
           Product: POI
           Version: 3.2-FINAL
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: apache@apconsult.de


The now deprecated method HSSFCell.setCellValue(String value)
has been changed to call the new method setCellValue(HSSFRichTextString value)
with a HSSFRichTextString Object.

The problem with that, is that a null String gets replaced with
a HSSFRichTextString Object with the value "" (i.e. length 0).

This broke our application, which I have fixed by calling
setCellValue((HSSFRichTextString)null)

I believe the correct implementation of HSSFCell.setCellValue(String value)
should be:
if (value == null) {
setCellValue((HSSFRichTextString)null);
} else {
setCellValue(new HSSFRichTextString(value));
}

This would be much more likely to be backward compatible with existing code.
I'm sure others will be having this problem, but have maybe not yet noticed
the subtle difference in their reports.

Best regards,
DaveLaw

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 47493] HSSFCell.setCellValue(String value) & HSSFRichTextString

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


Yegor Kozlov <ye...@dinom.ru> changed:

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




--- Comment #1 from Yegor Kozlov <ye...@dinom.ru>  2009-07-07 23:12:23 PST ---
Please try POI-3.5-beta7 or the latest trunk, the fix is already there:

    public void setCellValue(String value) {
        HSSFRichTextString str = value == null ? null :  new
HSSFRichTextString(value);
        setCellValue(str);
    }

Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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