Summary: | HSSFRichTextString.length() returns negative value if length > max | ||
---|---|---|---|
Product: | POI | Reporter: | Terry Paul <TerryRPaul> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | minor | ||
Priority: | P4 | ||
Version: | 3.2-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Attachments: | Contains string that exceeds max length of Excel cell. |
Description
Terry Paul
2008-12-09 08:53:55 UTC
Almost certainly a short vs int issue Can you please upload a file that triggers this, so we have something to hand to write a unit test against? Created attachment 23006 [details]
Contains string that exceeds max length of Excel cell.
The attached file contains the String that when loaded into an HSSFRichTextString causes the length() method to return a negative number.
Uploaded an attachment containing a String longer than 32767 to assist in testing. The attached file appears to be plain text, and not an excel file :( Any chance you could check your attachment, and re-upload? Actually, I found the bug when I was creating an Excel file from an XML file, from which this plain text was extracted. The logic that lead to the discovery was reading the text from the XML file, creating an HSSFRichTextString object with the text, and then checking the length of that HSSFRichTextString before calling HSSFCell.setCellValue() to ensure it didn't exceed our max allowable length for a cell. Apologies for not being more clear in my original description. |