cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 8264] - HSSF internazionalization problems with numbers
Date Fri, 19 Apr 2002 12:18:34 GMT
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 acoliver@apache.org  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: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message