DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8264>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8264

HSSF internazionalization problems with numbers





------- Additional Comments From [EMAIL PROTECTED]  2002-04-19 12:18 -------
I looked through this an all the code is doing is calling
Double.parseDouble(String) on the contents of <Cell></Cell> - in this case it's
using italian style decimals.  Invalidity is reported if a NumberFormatException
occurs.  What is the correct behavior here?  Shouldn't Double.parseDouble take
locality into account and properly parse the string?  If not, what would be a
more appropriate way to validate a number that takes locality into account?

    void setContent(final String content)
        throws IOException
    {
        if (_cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC)
        {
            try
            {
                if (_celltype == CellType.CELL_TYPE_FLOAT)
                {
                    _cell.setCellValue(Double.parseDouble(content));
                }
                else
                {
                    _cell.setCellValue(Integer.parseInt(content));
                }
            }
            catch (NumberFormatException e)
            {
                throw new IOException("Invalid value for a numeric cell: "
                                      + content);
            }
        }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to