poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 49761] Double.NaN can be written but not read with POI
Date Tue, 12 Oct 2010 14:54:57 GMT

--- Comment #7 from Theodor Mazilu <t.mazilu@candoprojects.com> 2010-10-12 10:54:53
EDT ---
I had the same problem, saw that a bugfix was coming in 3.7 beta3. Now 
I downloaded the fix tried it and it didn't work.

Since English is not my mother tongue either I didn't understand
the fix or this seem to be only a partial fix.

My stack trace would be the same as the reporters but the bug
description would be slightly different.

What I try to do is create a HSSFWorkbook from an existing xls-file:
POIFSFileSystem poifs = new POIFSFileSystem(fin);
workbook = new HSSFWorkbook(poifs);
This operation fails already in the reading of the InputStream.
As the original reporter posted in the class
there is the posted readDouble () method which doesn't expect 
Excell to deliver a double with the value NaN.
If somehow it does get a NaN it throws a RuntimeException.
Since the xls file I try to read seems to have a cell containing NaN
the whole process fails and the HSSFWorkbook is not created.

As I understand the bugfix, it fixes the setCellValue(double value)
of the HSSFCell to accept NaN.
But this method is never called since already reading the cell from the
Stream throws a RuntimeException.

I privately rewrote org.apache.poi.hssf.record.RecordInputStream.readDouble()
to not check for NaN and it worked for my case, but I don't know if there are
any sideeffects, so I'd rather post it here.
    public double readDouble() {
        long valueLongBits = readLong();
        double result = Double.longBitsToDouble(valueLongBits);
        return result;

Sorry for maybe posting about an already fixed bug, but
the stack trace of the bug is really like mine and it is still
happening with 3.7 beta 3.

Best Regards,

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

View raw message